A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://dotnet.github.io/dotNext/api/DotNext.Threading.AsyncBridge.html below:

Class AsyncBridge | .NEXT

Class AsyncBridge

Allows to turn WaitHandle and CancellationToken into task.

Namespace: DotNext.Threading Assembly: DotNext.Threading.dll Syntax
public static class AsyncBridge
Properties | Edit this page View Source MaxPoolSize

Gets or sets the capacity of the internal pool used to create awaitable tasks returned from the public methods in this class.

Declaration
public static int MaxPoolSize { get; set; }
Property Value Methods | Edit this page View Source AsCancellationToken(Task)

Returns a cancellation token that gets signaled when the task completes.

Declaration
public static CancellationToken AsCancellationToken(this Task task)
Parameters Type Name Description Task task

The task to observe.

Returns Type Description CancellationToken

The token that represents completion state of the task.

Exceptions | Edit this page View Source AsCancellationToken(Task, out Func<bool>)

Returns a cancellation token that gets signaled when the task completes.

Declaration
public static CancellationToken AsCancellationToken(this Task task, out Func<bool> disposeTokenSource)
Parameters Type Name Description Task task

The task to observe.

Func<bool> disposeTokenSource

A delegate that can be used to destroy the source of the returned token if no longer needed. It returns true if token was not canceled by the task; otherwise, false.

Returns Type Description CancellationToken

The token that represents completion state of the task.

Exceptions | Edit this page View Source WaitAnyAsync(ReadOnlySpan<CancellationToken>)

Creates a task that will complete when any of the supplied tokens have canceled.

Declaration
public static Task<CancellationToken> WaitAnyAsync(this ReadOnlySpan<CancellationToken> tokens)
Parameters Returns Exceptions | Edit this page View Source WaitAnyAsync(ReadOnlySpan<CancellationToken>, out Func<object?, bool>)

Creates a task that will complete when any of the supplied tokens have canceled.

Declaration
public static Task<CancellationToken> WaitAnyAsync(this ReadOnlySpan<CancellationToken> tokens, out Func<object?, bool> interruption)
Parameters Type Name Description ReadOnlySpan<CancellationToken> tokens

The tokens to wait on for cancellation.

Func<object, bool> interruption

An interruption procedure than can be used to turn the returned task into the failed state.

Returns Exceptions | Edit this page View Source WaitAsync(CancellationToken, bool)

Obtains a task that can be used to await token cancellation.

Declaration
public static ValueTask WaitAsync(this CancellationToken token, bool completeAsCanceled = false)
Parameters Returns Type Description ValueTask

A task representing token state.

Exceptions | Edit this page View Source WaitAsync(WaitHandle, CancellationToken)

Obtains a task that can be used to await handle completion.

Declaration
public static ValueTask WaitAsync(this WaitHandle handle, CancellationToken token = default)
Parameters Type Name Description WaitHandle handle

The handle to await.

CancellationToken token

The token that can be used to cancel the operation.

Returns Type Description ValueTask

The task that will be completed .

Exceptions | Edit this page View Source WaitAsync(WaitHandle, TimeSpan, CancellationToken)

Obtains a task that can be used to await handle completion.

Declaration
public static ValueTask<bool> WaitAsync(this WaitHandle handle, TimeSpan timeout, CancellationToken token = default)
Parameters Type Name Description WaitHandle handle

The handle to await.

TimeSpan timeout

The timeout used to await completion.

CancellationToken token

The token that can be used to cancel the operation.

Returns Exceptions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4