Class AsyncManualResetEvent
- Namespace
- Microsoft.VisualStudio.Threading
- Assembly
- Microsoft.VisualStudio.Threading.dll
A flavor of ManualResetEvent that can be asynchronously awaited on.
public class AsyncManualResetEvent
- Inheritance
-
AsyncManualResetEvent
- Inherited Members
Constructors
AsyncManualResetEvent(bool, bool)
Initializes a new instance of the AsyncManualResetEvent class.
public AsyncManualResetEvent(bool initialState = false, bool allowInliningAwaiters = false)
Parameters
initialState
boolA value indicating whether the event should be initially signaled.
allowInliningAwaiters
boolA value indicating whether to allow WaitAsync() callers' continuations to execute on the thread that calls Microsoft.VisualStudio.Threading.AsyncManualResetEvent.SetAsync() before the call returns. Microsoft.VisualStudio.Threading.AsyncManualResetEvent.SetAsync() callers should not hold private locks if this value is true to avoid deadlocks. When false, the task returned from WaitAsync() may not have fully transitioned to its completed state by the time Microsoft.VisualStudio.Threading.AsyncManualResetEvent.SetAsync() returns to its caller.
Properties
IsSet
Gets a value indicating whether the event is currently in a signaled state.
public bool IsSet { get; }
Property Value
Methods
PulseAll()
Sets and immediately resets this event, allowing all current waiters to unblock.
public void PulseAll()
Reset()
Resets this event to a state that will block callers of WaitAsync().
public void Reset()
Set()
Sets this event to unblock callers of WaitAsync().
public void Set()
WaitAsync()
Returns a task that will be completed when this event is set.
public Task WaitAsync()
Returns
WaitAsync(CancellationToken)
Returns a task that will be completed when this event is set.
public Task WaitAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenA cancellation token.
Returns
- Task
A task that completes when the event is set, or cancels with the
cancellationToken
.