Boost logo

Boost :

From: Scott McCaskill (scott_at_[hidden])
Date: 2001-08-13 09:37:24


> No, because the Win32 WaitForMultiple*() operations won't gaurantee
> you the order in which the objects are acquired. It's likely that
> the mutex will be acquired first, preventing other threads from
> modifying the state in order to signal the event, so you wind up with
> a deadlock caused from a race condition.
>

Actually, I don't think that deadlock can occur in this way. From the MSDN
documentation for WFMO (in the case where fWaitAll is set to TRUE):

"[WaitForMultipleObjects] does not modify the states of the specified
objects until the states of all objects have been set to signaled. For
example, a mutex can be signaled, but the thread does not get ownership
until the states of the other objects are also set to signaled."

It may be technically correct to say that the order of acquistion is not
specified, but in this case I think that is a distinction without a
difference.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk