SemaphoreSlim.WaitAsync Method (CancellationToken)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Asynchronously waits to enter the SemaphoreSlim, while observing a CancellationToken.

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

Syntax

Public Function WaitAsync ( _
    cancellationToken As CancellationToken _
) As Task
public Task WaitAsync(
    CancellationToken cancellationToken
)

Parameters

Return Value

Type: System.Threading.Tasks..::.Task
A task that will complete when the semaphore has been entered.

Exceptions

Exception Condition
ObjectDisposedException

The current instance has already been disposed.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0

See Also

Reference

SemaphoreSlim Class

WaitAsync Overload

System.Threading Namespace