Class AsyncEvent
Represents various extension methods for types implementing IAsyncEvent interface.
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public static class AsyncEvent : object
Methods
| Improve this Doc View SourceWait(IAsyncEvent)
Turns caller into idle state until the current event is set.
Declaration
public static Task Wait(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.
Wait(IAsyncEvent, CancellationToken)
Turns caller into idle state until the current event is set.
Declaration
public static Task Wait(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.
Wait(IAsyncEvent, TimeSpan)
Turns caller into idle state until the current event is set.
Declaration
public static Task<bool> Wait(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. |