Subj : Re: waitformultipleobjects() on several semaphores ? To : comp.programming.threads From : Neill Clift [MSFT] Date : Sat Feb 05 2005 03:29 pm "Joseph Seigh" wrote in message news:opsloo9dsgbs6ffg@grunion... > On Fri, 4 Feb 2005 08:53:16 -0800, Neill Clift [MSFT] > wrote: > >> "Joseph Seigh" wrote in message >> news:opsln87xpcbs6ffg@grunion... >>> On Fri, 4 Feb 2005 04:04:27 +0100, mandatory >>> wrote: >>> >>> The bWaitAll parameter must be set to FALSE so that the wait will return >>> if any of the wait objects have been signaled. You'll have the check >>> the >>> return code to correctly identify which semaphore got signaled. If >>> Microsoft's WaitForMultipleObjects implementation allows for more than >>> one semaphore signal to get consumed on a wait any option then you'll >>> have >>> to find another solution. I don't think it would allow that. That >>> would be pretty stupid, even for Microsoft. >>> >> >> The API will only create one side effect in the list of objects for a >> wait >> any call. So you would own one mutex or consume one semaphore >> release etc. >> > Thanks for clarifying. The documentation wasn't as explicit as it > could have been so I wasn't going to give an authoritative answer. > > Description > WAIT_OBJECT_0 to > (WAIT_OBJECT_0 + nCount ? 1) > If bWaitAll is TRUE, the return value > indicates that the state of all > specified > objects is signaled. > > If bWaitAll is FALSE, the return value > minus WAIT_OBJECT_0 indicates the > lpHandles array index of the object > that > satisfied the wait. If more than one > object > became signaled during the call, this > is the > array index of the signaled object with > the > smallest index value of all the > signaled > objects. > I'll see if I can get it clarified. Thanks. .