Subj : Re: waitformultipleobjects() on several semaphores ? To : comp.programming.threads From : Joseph Seigh Date : Fri Feb 04 2005 07:05 am On Fri, 4 Feb 2005 04:04:27 +0100, mandatory wrote: > hi, > > Am i right when i say that using WaitForMultipleObjects() wont work if you > have several semaphores in the same event-array ? > > If im using events i can run through my array after a event, to check if > several has been activated at the same time, but i think that sempahores > will fire, and its no secondary check is possible - right ? > > Sorry for the description, im pretty tired, but i think this is my > conclusion. > > Do any of you have any ideas on how to solve it instead ? the problem is > that i have 2 queues that im waiting on - both are activated with a > semaphore, and my initial thought was that i just could use > WaitForMultipleObjects() - but i guess i was wrong :( > 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. -- Joe Seigh .