System.Threading.AutoResetEvent.Set Method

Sets the state of the event to signaled, which allows at most one waiting thread to proceed.

Syntax

public bool Set ()

Returns

true if the operation succeeds; otherwise, false.

Remarks

Note:

Starting with the dnprdnext and the compact_v35_long, this member is inherited from System.Threading.EventWaitHandle. See EventWaitHandle.Set.

The AutoResetEvent.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 AutoResetEvent.Set method will release a thread. If two calls are too close together, so that the second call occurs before a thread has been released, only one thread is released — as if the second call did not happen. Also, if the AutoResetEvent.Set method is called when there are no threads waiting and the System.Threading.AutoResetEvent is already signaled, the call has no effect.

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0