Unexpected reentrancy on Wait,etc...



Hello,

I have run into a serious reentrancy problem. It appears from a stack
trace that lock, WaitOne and Thread.Join do some servicing of the
message queue. Here is the setup:

The GUI thread uses a combination of Application.Idle and a timer to
simulate the old MFC OnIdle. The Idle handling will periodically pick
up some work that requires executing some non-reentrant code. This
code uses several locks to synchronize with other threads.

Another background worker thread is calling thru the Application's
API. The API must use Control.Invoke using the MainForm to marshal
the calls to the GUI thread. It also calls the non-reentrant code.

While GUI thread is waiting on a lock (I presume that it is already
held by a 3rd thread), the Control.Invoke can occassionaly slip thru
and cause reentrancy. Anyone familiar with the perils of DoEvents
will understand why this is a major problem.

Any suggestions?

Sincerely, Jake

.



Relevant Pages

  • Re: Unexpected reentrancy on Wait,etc...
    ... The GUI thread uses a combination of Application.Idle and a timer to ... The API must use Control.Invoke using the MainForm to marshal ... It also calls the non-reentrant code. ... While GUI thread is waiting on a lock (I presume that it is already ...
    (microsoft.public.dotnet.framework.clr)
  • Re: [wxPython-users] Re:
    ... can rewrite it fairly reasonably in Python via 'for line in open:'. ... In terms of locks, you have to use a lock that can be acquired by either ... the GUI thread in wxPython may still not like being called directly. ...
    (comp.lang.python)
  • Re: deadlock question
    ... If it is in your main GUI thread, any long computation is going to lock up the GUI thread ... >I'm getting that error from Boundchecker when I use CMutex instead ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)

Loading