Subj : Re: waitformultipleobjects() on several semaphores ? To : comp.programming.threads From : mandatory Date : Fri Feb 04 2005 07:34 pm "Neill Clift [MSFT]" skrev i en meddelelse news:4203a87c$1@news.microsoft.com... >> 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. Im not sure i understand you here. I have this array "semaphores" which contains 4 valid handles for 4 sempahores: HANDLE semaphores[4]; In ThreadA i have a wait: dwStatus = WaitForMultipleObjects (4, semaphores, FALSE, INFINITE); If one semaphore is signalled, then it is ok - i get the dwStatus value of the semphore which was signalled. The problem i think im experiencing, is what if 2 semaphores are signalled at the same time ? If it was events, i normally would do like this: dwStatus = WaitForMultipleObjects (numberofevents, eventarray, FALSE, INFINITE); if (dStatus!= WAIT_TIMEOUT) { for (int i=0;i