Subj : Re: waitformultipleobjects() on several semaphores ? To : comp.programming.threads From : Joseph Seigh Date : Mon Feb 07 2005 02:00 pm On Mon, 07 Feb 2005 12:50:25 -0500, Joseph Seigh wrote: > On Mon, 7 Feb 2005 08:59:24 -0800, Neill Clift [MSFT] wrote: > >> "Neill Clift [MSFT]" wrote in message >> news:420556d5$1@news.microsoft.com... >> ... >>> >>> I'll see if I can get it clarified. >>> Thanks. >>> >> >> It does seem to have a clear statement of this when I >> checked this morning on MSDN website: >> > When bWaitAll is FALSE, this function checks the handles in the array in order > starting with index 0, until one of the objects is signaled. If multiple objects become > signaled, the function returns the index of the first handle in the array whose object was > signaled. > >> The function modifies the state of some types of synchronization objects. >> Modification occurs only for the object or objects whose signaled state >> caused the function to return. For example, the count of a semaphore object >> is decreased by one. For more information, see the documentation for the >> individual synchronization objects. >> > It's just slightly confusing terminology. To make it unambiguous, it should > say that modification only occurs for the synchronization object that is returned > in the index of WAIT_OBJECT_0 for the bWaitAll == FALSE case , and maybe list the > synchronization objects that do get modified by wait. > > The documentation doesn't actually say that the first object found signaled is the > one that actually caused it to return. It just says that's the index it returns. > And it mentions twices that multiple objects can be signaled. It's not clear. > I see it. It's further up. bWaitAll [in] If this parameter is TRUE, the function returns when the state of all objects in the lpHandles array is signaled. If FALSE, the function returns when the state of any one of the objects is set to signaled. In the latter case, the return value indicates the object whose state caused the function to return. So you can figure it out if you piece together 2 or 3 sections of the documentation and ignore the bits that say multiple objects can be signaled. -- Joe Seigh .