Udostępnij za pośrednictwem


JoinableTask<T>.JoinAsync(CancellationToken) Method

Definition

Joins any main thread affinity of the caller with the asynchronous operation to avoid deadlocks in the event that the main thread ultimately synchronously blocks waiting for the operation to complete.

public System.Threading.Tasks.Task<T> JoinAsync (System.Threading.CancellationToken cancellationToken = default);
override this.JoinAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
Public Function JoinAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)

Parameters

cancellationToken
CancellationToken

A cancellation token that will exit this method before the task is completed.

Returns

Task<T>

A task that completes after the asynchronous operation completes and the join is reverted, with the result of the operation.

Exceptions

Thrown when cancellationToken is canceled.

Remarks

Any exception thrown by the asynchronous operation is propagated out to the caller of this method.

Applies to