Class AsyncAutoResetEvent
- Namespace
- Microsoft.VisualStudio.Threading
- Assembly
- Microsoft.VisualStudio.Threading.dll
An asynchronous implementation of an AutoResetEvent.
public class AsyncAutoResetEvent
- Inheritance
-
AsyncAutoResetEvent
- Inherited Members
Constructors
AsyncAutoResetEvent()
Initializes a new instance of the AsyncAutoResetEvent class that does not inline awaiters.
public AsyncAutoResetEvent()
AsyncAutoResetEvent(bool)
Initializes a new instance of the AsyncAutoResetEvent class.
public AsyncAutoResetEvent(bool allowInliningAwaiters)
Parameters
allowInliningAwaiters
boolA value indicating whether to complete the task synchronously in the Set() method, as opposed to asynchronously. false better simulates the behavior of the AutoResetEvent class, but true can result in slightly better performance.
Methods
Set()
Unblocks one waiter or sets the signal if no waiters are present so the next waiter may proceed immediately.
public void Set()
WaitAsync()
Returns an awaitable that may be used to asynchronously acquire the next signal.
public Task WaitAsync()
Returns
- Task
An awaitable.
WaitAsync(CancellationToken)
Returns an awaitable that may be used to asynchronously acquire the next signal.
public Task WaitAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenA token whose cancellation removes the caller from the queue of those waiting for the event.
Returns
- Task
An awaitable.