Share via

AutoResetEvent.Set Method


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

 bool Set();
public bool Set ();
member this.Set : unit -> bool
Public Function Set () As Boolean


true if the operation succeeds; otherwise, false.


This method releases a single thread and then resets the event automatically. If there are no waiting threads, the wait handle remains signaled until a thread attempts to wait on it or until the Reset method is called.


There is no guarantee that every call to the 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 Set method is called when there are no threads waiting and the AutoResetEvent is already signaled, the call has no effect.

Applies to