EventWaitHandle, AutoResetEvent, CountdownEvent, 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
The EventWaitHandle class can represent either automatic or manual reset events and either local events or named system events.
- ManualResetEvent and ManualResetEventSlim
The ManualResetEvent class derives from EventWaitHandle and represents a local event that must be reset manually. The ManualResetEventSlim class is a lightweight, faster version that can be used for events within the same process.
The CountdownEvent class provides a simplified way to implement fork/join parallelism patterns in code that uses wait handles.