Open sandboxFocus

Method AcquireAsync

AcquireAsync(TimeSpan, CancellationToken)

Asynchronously acquires the lock bound to the current handle.

Declaration
Task<bool> AcquireAsync(TimeSpan timeout, CancellationToken cancellationToken)
Parameters
Type Name Description
TimeSpan timeout

Timeout.

CancellationToken cancellationToken

A CancellationToken.

Returns
Type Description
Task<bool>

true if the lock was acquired, or false if the operation has timed out before the lock could be acquired.