TryLockAsync Method
TryLockAsync(LockContext, TimeSpan)
Tries to acquire the lock for the specified lockContext context.
Declaration
Task<bool> TryLockAsync(LockContext lockContext, TimeSpan timeout)
Parameters
| LockContext | lockContext | The LockContext. |
| TimeSpan | timeout | The maximum time to wait for the lock. |
Returns
| Task<bool> |
|
Remarks
If the lock is available or already held by the current specified lockContext
at the time of invocation and the acquisition limit is not exceeded, the method immediately returns
true. If the lock is not immediately available, the method waits for the specified
timeout, and eventually returns false.
TryLockAsync(LockContext)
Tries to acquire the lock for the specified lockContext context.
Declaration
Task<bool> TryLockAsync(LockContext lockContext)
Parameters
| LockContext | lockContext | The LockContext. |
Returns
| Task<bool> |
|
Remarks
If the lock is available or already held by the current specified lockContext
at the time of invocation and the acquisition limit is not exceeded, the method immediately returns
true. If the lock is not immediately available, the method immediately returns false.