Class AsyncEvent
Represents various extension methods for types implementing IAsyncEvent interface.
Inherited Members
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public static class AsyncEvent
Methods
| Improve this Doc View SourceWaitAsync(IAsyncEvent)
Turns caller into idle state until the current event is set.
Declaration
public static Task WaitAsync(this IAsyncEvent event)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEvent | event | An event to synchronize with. |
Returns
Type | Description |
---|---|
Task | A promise of signaled state. |
Remarks
This method can potentially blocks execution of async flow infinitely.
WaitAsync(IAsyncEvent, CancellationToken)
Turns caller into idle state until the current event is set.
Declaration
public static Task WaitAsync(this IAsyncEvent event, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEvent | event | An event to synchronize with. |
CancellationToken | token | The token that can be used to abort wait process. |
Returns
Type | Description |
---|---|
Task | A promise of signaled state. |
Remarks
This method can potentially blocks execution of async flow infinitely.
WaitAsync(IAsyncEvent, TimeSpan)
Turns caller into idle state until the current event is set.
Declaration
public static Task<bool> WaitAsync(this IAsyncEvent event, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEvent | event | An event to synchronize with. |
TimeSpan | timeout | The interval to wait for the signaled state. |
Returns
Type | Description |
---|---|
Task<Boolean> | true if signaled state was set; otherwise, false. |