System.Threading.EventWaitHandle.Set Method

Sets the state of the event to signaled, allowing one or more waiting threads to proceed.

Syntax

public bool Set ()

Returns

true if the operation succeeds; otherwise, false.

Remarks

For an System.Threading.EventWaitHandle with EventResetMode.AutoReset (including System.Threading.AutoResetEvent), the EventWaitHandle.Set method releases a single thread. If there are no waiting threads, the wait handle remains signaled until a thread attempts to wait on it, or until its EventWaitHandle.Reset method is called.

Note:

There is no guarantee that every call to the EventWaitHandle.Set method will release a thread from an System.Threading.EventWaitHandle whose reset mode is EventResetMode.AutoReset. If two calls are too close together, so that the second call occurs before a thread has been released, only one thread is released. It is as if the second call did not happen. Also, if EventWaitHandle.Set is called when there are no threads waiting and the System.Threading.EventWaitHandle is already signaled, the call has no effect.

For an System.Threading.EventWaitHandle with EventResetMode.ManualReset (including System.Threading.ManualResetEvent), calling the EventWaitHandle.Set method leaves the wait handle in a signaled state until its EventWaitHandle.Reset method is called.

Requirements

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