AsyncManualResetEvent
An async-compatible manual-reset event.
Assembly: ServiceStack.Common.dll
View Source
public sealed class AsyncManualResetEvent
Properties
Id
Gets a semi-unique identifier for this asynchronous manual-reset event.
View Source
public int Id { get; }
IsSet
Whether this event is currently set. This member is seldom used; code using this member has a high possibility of race conditions.
View Source
public bool IsSet { get; }
Methods
WaitAsync()
Asynchronously waits for this event to be set.
View Source
public Task WaitAsync()
Returns
System.Threading.Tasks.Task
WaitAsync(CancellationToken)
Asynchronously waits for this event to be set or for the wait to be canceled.
View Source
public Task WaitAsync(CancellationToken cancellationToken)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | The cancellation token used to cancel the wait. If this token is already canceled, this method will first check whether the event is set. |
|
Wait()
Synchronously waits for this event to be set. This method may block the calling thread.
View Source
public void Wait()
Wait(CancellationToken)
Synchronously waits for this event to be set. This method may block the calling thread.
View Source
public void Wait(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | The cancellation token used to cancel the wait. If this token is already canceled, this method will first check whether the event is set. |
|
Set()
Sets the event, atomically completing every task returned by <see cref="O:ServiceStack.AsyncEx.AsyncManualResetEvent.WaitAsync"></see>. If the event is already set, this method does nothing.
View Source
public void Set()
Reset()
Resets the event. If the event is already reset, this method does nothing.
View Source
public void Reset()