Class AsyncBridge
Allows to turn
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public static class AsyncBridge : object
Methods
| Improve this Doc View SourceWaitAsync(CancellationToken, Boolean)
Obtains a task that can be used to await token cancellation.
Declaration
public static CancellationTokenFuture WaitAsync(this CancellationToken token, bool completeAsCanceled = false)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | token | The token to be converted into task. |
Boolean | completeAsCanceled | true to complete task in |
Returns
Type | Description |
---|---|
CancellationTokenFuture | A task representing token state. |
WaitAsync(WaitHandle)
Obtains a task that can be used to await handle completion.
Declaration
public static WaitHandleFuture WaitAsync(this WaitHandle handle)
Parameters
Type | Name | Description |
---|---|---|
WaitHandle | handle | The handle to await. |
Returns
Type | Description |
---|---|
WaitHandleFuture | The task that will be completed . |
WaitAsync(WaitHandle, TimeSpan)
Obtains a task that can be used to await handle completion.
Declaration
public static WaitHandleFuture WaitAsync(this WaitHandle handle, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
WaitHandle | handle | The handle to await. |
TimeSpan | timeout | The timeout used to await completion. |
Returns
Type | Description |
---|---|
WaitHandleFuture | true if handle is signaled; otherwise, false if timeout occurred. |