Re: WaitForSingleObject() will not deadlock
- From: Frank Cusack <fcusack@xxxxxxxxxxx>
- Date: Sun, 01 Jul 2007 01:39:33 -0700
Actually I'm quite expert in posix threads (and associated
synchronization primitives). I'm just new to the Windows world. As I
said in another post, the code example shown is obviously not useful
and so it should have been obvious that it was a simplification to
get to the heart of the matter.
On Sat, 30 Jun 2007 23:06:51 -0400 Joseph M. Newcomer <newcomer@xxxxxxxxxxxx> wrote:
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: Joseph M . Newcomer
- Re: WaitForSingleObject() will not deadlock
- References:
- Re: WaitForSingleObject() will not deadlock
- From: Joseph M . Newcomer
- 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):