System.Threading.EventWaitHandle Class

Represents a thread synchronization event.

See Also: EventWaitHandle Members


public class EventWaitHandle : WaitHandle


The System.Threading.EventWaitHandle class allows threads to communicate with each other by signaling. Typically, one or more threads block on an System.Threading.EventWaitHandle until an unblocked thread calls the EventWaitHandle.Set method, releasing one or more of the blocked threads. A thread can signal an System.Threading.EventWaitHandle and then block on it, by calling the static (Shared in Visual Basic) erload:System.Threading.WaitHandle.SignalAndWait method.


The System.Threading.EventWaitHandle class provides access to named system synchronization events.

The behavior of an System.Threading.EventWaitHandle that has been signaled depends on its reset mode. An System.Threading.EventWaitHandle created with the EventResetMode.AutoReset flag resets automatically when signaled, after releasing a single waiting thread. An System.Threading.EventWaitHandle created with the EventResetMode.ManualReset flag remains signaled until its EventWaitHandle.Reset method is called.

Automatic reset events provide exclusive access to a resource. If an automatic reset event is signaled when no threads are waiting, it remains signaled until a thread attempts to wait on it. The event releases the thread and immediately resets, blocking subsequent threads.

Manual reset events are like gates. When the event is not signaled, threads that wait on it will block. When the event is signaled, all waiting threads are released, and the event remains signaled (that is, subsequent waits do not block) until its EventWaitHandle.Reset method is called. Manual reset events are useful when one thread must complete an activity before other threads can proceed.

System.Threading.EventWaitHandle objects can be used with the static (Shared in Visual Basic) erload:System.Threading.WaitHandle.WaitAll and erload:System.Threading.WaitHandle.WaitAny methods.

For more information about thread synchronization mechanisms, see EventWaitHandle, AutoResetEvent, and ManualResetEvent.


Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions:,
Since: .NET 2.0