AutoResetEvent.Set Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the state of the event to signaled, which allows at most one waiting thread to proceed.
public:
bool Set();
public bool Set ();
member this.Set : unit -> bool
Public Function Set () As Boolean
Returns
true
if the operation succeeds; otherwise, false
.
Remarks
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.
Important
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.