ManualResetEvent and ManualResetEventSlim

The System.Threading.ManualResetEvent class represents a local wait handle event that must be reset manually after it is signaled. This class represents a special case of its base class, System.Threading.EventWaitHandle. See the EventWaitHandle conceptual documentation for the use and features of manual reset events.

A ManualResetEvent object remains signaled until its EventWaitHandle.Reset method is called. Any number of waiting threads, or threads that wait on the event after it has been signaled, can be released while the object's state is signaled. ManualResetEvent corresponds to a Win32 CreateEvent call, specifying true for the bManualReset argument.

In the .NET Framework version 4, you can use the System.Threading.ManualResetEventSlim class for better performance when wait times are expected to be very short, and when the event does not cross a process boundary. ManualResetEventSlim uses busy spinning for a short time while it waits for the event to become signaled. When wait times are short, spinning can be much less expensive than waiting by using wait handles. However, if the event does not become signaled within a certain period of time, ManualResetEventSlim resorts to a regular event handle wait.

See Also

Concepts

Wait Handles

AutoResetEvent

SpinWait

Semaphore and SemaphoreSlim

Other Resources

Managed Threading

Threading Objects and Features