EventWaitHandle, AutoResetEvent, and ManualResetEvent
Event wait handles allow threads to synchronize activities by signaling each other and by waiting on each other's signals. These synchronization events are based on Win32 wait handles and can be divided into two types: those that reset automatically when signaled and those that are reset manually.
Event wait handles are useful in many of the same synchronization scenarios as the Monitor class. Event wait handles are often easier to use than the Monitor.Wait and Monitor.Pulse methods, and they offer more control over signaling. Named event wait handles can also be used to synchronize activities across application domains and processes, whereas monitors are local to an application domain.
In This Section
EventWaitHandle
The EventWaitHandle class can represent either automatic or manual reset events and either local events or named system events.AutoResetEvent
The AutoResetEvent class derives from EventWaitHandle and represents a local event that resets automatically.ManualResetEvent
The ManualResetEvent class derives from EventWaitHandle and represents a local event that must be reset manually.
Related Sections
- Wait Handles
The WaitHandle class is the base class for the EventWaitHandle, Semaphore, and Mutex classes. It contains static methods such as SignalAndWait and WaitAll that are useful when working with all types of wait handles.