Re: WaitForSingleObject() will not deadlock
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Sat, 30 Jun 2007 23:06:51 -0400
Mutexes are not autoreset or manual reset; you are confusing them with events.
The OP is clueless about synchronization. All solutions relating to using mutexes,
semaphores, or events will be incorrect answers to his problem.
joe
On Sat, 30 Jun 2007 23:39:48 +0800, ajk <ak@xxxxxxxxxxxx> wrote:
On Sat, 30 Jun 2007 00:31:03 -0700, Frank Cusack <fcusack@xxxxxxxxxxx>Joseph M. Newcomer [MVP]
wrote:
Code like this
if (WaitForSingleObject(mutex, INFINITE) == WAIT_OBJECT_0)
AfxMessageBox("acquired", ID_OK);
if (WaitForSingleObject(mutex, INFINITE) == WAIT_OBJECT_0)
AfxMessageBox("acquired", ID_OK);
displays 2 alert boxes. How do I make this deadlock instead?
-frank
how did you create your mutex? was it autoreset or manual (my bet).
if you want to "deadlock" you need to call it from two threads, not
after each other - probably what is happening, once the mutex signaled
both WaitForSingleObject fires.
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: WaitForSingleObject() will not deadlock
- From: ajk
- Re: WaitForSingleObject() will not deadlock
- From: Frank Cusack
- Re: WaitForSingleObject() will not deadlock
- Prev by Date: Re: WaitForSingleObject() will not deadlock
- Next by Date: Re: WaitForSingleObject() will not deadlock
- Previous by thread: Re: WaitForSingleObject() will not deadlock
- Next by thread: Re: WaitForSingleObject() will not deadlock
- Index(es):