tags:

views:

1253

answers:

2

This:

http://msdn.microsoft.com/en-us/library/ms686915(VS.85).aspx

Would seem to suggest not.

I have three processes communicating via pipes. Process A Creates an event, Process B & C each use WaitForSingleObject (in a second thread).

So now we have -TWO- Processes each waiting for a -SINGLE- event.

Process A fires the event with SetEvent(), Process B responds, process C does not.

Conclusion:

Each WaitForSingleObject() requires a unique Event... Correct?

+4  A: 

Use manual reset events to trigger multiple threads off of a single event.

Here is an example which uses "Manual Reset Event" flag

Vinay
Unfortunatly I have no control over process A so I cannot implement that.
Mike Trader
+2  A: 

You can use the Manual Reset Evenets and the PulseEvent function to release all of the threads currently waiting for the event.

Note however, that this approach is inherently racy, as there is no way to tell which are "the threads currently waiting ...". You should use a more reliable synchronization mechanism if exact matching of the wakeup/2 wait events are needed.

jpalecek
I did not mention this, but i do not have any control over process A, but I will look at the PulseEvent function for future reference.. thanks.
Mike Trader
jpalecek
Do not use PulseEvent, see http://blogs.msdn.com/oldnewthing/archive/2005/01/05/346888.aspx
CesarB