Freigeben über


JoinableTask.JoinAsync(CancellationToken) Method

Definition

Shares any access to the main thread the caller may have 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 JoinAsync (System.Threading.CancellationToken cancellationToken = default);
member this.JoinAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function JoinAsync (Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

cancellationToken
CancellationToken

A cancellation token that will revert the Join and cause the returned task to complete before the async operation has completed.

Returns

A task that completes after the asynchronous operation completes and the join is reverted.

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