Partilhar via


JoinableTask<T>.Join(CancellationToken) Method

Definition

Synchronously blocks the calling thread until the operation has completed. If the calling thread is the Main thread, deadlocks are mitigated.

public T Join (System.Threading.CancellationToken cancellationToken = default);
override this.Join : System.Threading.CancellationToken -> 'T
Public Function Join (Optional cancellationToken As CancellationToken = Nothing) As T

Parameters

cancellationToken
CancellationToken

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

Returns

T

The result of the asynchronous 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