Skip to main content

AsyncManualResetEvent

An async-compatible manual-reset event.

Assembly: ServiceStack.Common.dll
View Source
Declaration
public sealed class AsyncManualResetEvent

Properties

Id

Gets a semi-unique identifier for this asynchronous manual-reset event.

View Source
Declaration
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
Declaration
public bool IsSet { get; }

Methods

WaitAsync()

Asynchronously waits for this event to be set.

View Source
Declaration
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
Declaration
public Task WaitAsync(CancellationToken cancellationToken)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.Threading.CancellationTokencancellationTokenThe 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
Declaration
public void Wait()

Wait(CancellationToken)

Synchronously waits for this event to be set. This method may block the calling thread.

View Source
Declaration
public void Wait(CancellationToken cancellationToken)
Parameters
TypeNameDescription
System.Threading.CancellationTokencancellationTokenThe 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
Declaration
public void Set()

Reset()

Resets the event. If the event is already reset, this method does nothing.

View Source
Declaration
public void Reset()