Show / Hide Table of Contents

Class AsyncBridge

Allows to turn WaitHandle and CancellationToken into task.

Inheritance
Object
AsyncBridge
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public static class AsyncBridge

Methods

| Improve this Doc View Source

WaitAsync(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 Canceled state; false to complete task in RanToCompletion state.

Returns
Type Description
CancellationTokenFuture

A task representing token state.

Exceptions
Type Condition
ArgumentException

token doesn't support cancellation.

| Improve this Doc View Source

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 .

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX