Detecting a stale Mutex

Posted by sum1stolemyname on Stack Overflow See other posts from Stack Overflow or by sum1stolemyname
Published on 2010-06-15T06:10:58Z Indexed on 2010/06/15 6:22 UTC
Read the original article Hit count: 259

Is there any technique or tool available to detect this kind of a deadlock during runtime?

picture this in a worker thread (one of several, normally 4-6)

try
   WaitForSingleObject(myMutex);
   DoSTuffThatMightCauseAnException;
Except
   ReleaseMutex(myMutex);
end;

or more generally is there a design-pattern to avoid these kind of bugs?

I coded the above code in the little hous after a longer hacking run

© Stack Overflow or respective owner

Related posts about multithreading

Related posts about debugging