[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Notifies a waiting thread that an event has occurred. This class cannot be inherited.
Assembly: mscorlib (in mscorlib.dll)
Thetype exposes the following members.
|Equals(Object)||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|Reset||Sets the state of the event to nonsignaled, which causes threads to block.|
|Set||Sets the state of the event to signaled, which allows at most one waiting thread to proceed.|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
|WaitOne()()()()||Blocks the current thread until the current WaitHandle receives a signal. (Inherited from WaitHandle.)|
|WaitOne(Int32, Boolean)||Blocks the current thread until the current WaitHandle receives a signal, using a 32-bit signed integer to specify the time interval and specifying whether to exit the synchronization domain before the wait. (Inherited from WaitHandle.)|
AutoResetEvent allows threads to communicate with each other by signaling. Typically, you use this class when threads need exclusive access to a resource.
A thread waits for a signal by calling WaitOne on the AutoResetEvent. If the AutoResetEvent is in the non-signaled state, the thread blocks, waiting for the thread that currently controls the resource to signal that the resource is available by calling .
Calling Set signals AutoResetEvent to release a waiting thread. AutoResetEvent remains signaled until a single waiting thread is released, and then automatically returns to the non-signaled state. If no threads are waiting, the state remains signaled indefinitely.
If a thread calls WaitOne while the is in the signaled state, the thread does not block. The releases the thread immediately and returns to the non-signaled state.
You can control the initial state of an AutoResetEvent by passing a Boolean value to the constructor: true if the initial state is signaled and false otherwise.
Unlike the class, the class provides access to named system synchronization events.