Share via


Set Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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

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

Syntax

'Declaration
Public Function Set As Boolean
public bool Set()
public:
bool Set()
member Set : unit -> bool 
public function Set() : boolean

Return Value

Type: System. . :: . .Boolean
true if the operation succeeds; otherwise, false.

Remarks

The 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 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.

.NET Framework Security

See Also

Reference

AutoResetEvent Class

System.Threading Namespace