Class TaskCompletionSourceExtensions (4.8.0)

public static class TaskCompletionSourceExtensions

Extension methods for TaskCompletionSource<TResult>.

Inheritance

object > TaskCompletionSourceExtensions

Namespace

Google.Api.Gax

Assembly

Google.Api.Gax.dll

Methods

WithCancellationToken<TResult>(TaskCompletionSource<TResult>, CancellationToken)

public static Task<TResult> WithCancellationToken<TResult>(this TaskCompletionSource<TResult> source, CancellationToken cancellationToken)

Returns a task from a task completion source, but observing a given cancellation token.

Parameters
Name Description
source TaskCompletionSource

The task completion source. Must not be null.

cancellationToken CancellationToken

The cancellation token to observe.

Returns
Type Description
Task

A task that will complete when source completes, but will observe cancellationToken for cancellation.

Type Parameter
Name Description
TResult

The result type of the task completion source