PostSharpAPI ReferencePost­Sharp.​Patterns.​Caching.​LockingILock­HandleAcquire­Async
Open sandboxFocus

ILockHandle.AcquireAsync Method

AcquireAsync(TimeSpan, CancellationToken)

Asynchronously acquires the lock bound to the current handle.

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

Timeout.

System.Threading.CancellationToken cancellationToken

A System.Threading.CancellationToken.

Returns
Type Description
Task<Boolean>

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