Show / Hide Table of Contents

Class AsyncExclusiveLock

Represents asynchronous mutually exclusive lock.

Inheritance
Object
QueuedSynchronizer
AsyncExclusiveLock
Implements
ISynchronizer
Inherited Members
QueuedSynchronizer.ISynchronizer.HasWaiters
QueuedSynchronizer.Dispose(Boolean)
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public class AsyncExclusiveLock : QueuedSynchronizer, ISynchronizer

Properties

| Improve this Doc View Source

IsLockHeld

Indicates that exclusive lock taken.

Declaration
public bool IsLockHeld { get; }
Property Value
Type Description
Boolean

Methods

| Improve this Doc View Source

Acquire(CancellationToken)

Enters the lock in exclusive mode asynchronously.

Declaration
public Task Acquire(CancellationToken token)
Parameters
Type Name Description
CancellationToken token

The token that can be used to abort lock acquisition.

Returns
Type Description
Task

The task representing lock acquisition operation.

| Improve this Doc View Source

Acquire(TimeSpan)

Enters the lock in exclusive mode asynchronously.

Declaration
public Task Acquire(TimeSpan timeout)
Parameters
Type Name Description
TimeSpan timeout

The interval to wait for the lock.

Returns
Type Description
Task

The task representing lock acquisition operation.

| Improve this Doc View Source

Release()

Releases previously acquired exclusive lock.

Declaration
public void Release()
| Improve this Doc View Source

TryAcquire()

Attempts to obtain exclusive lock synchronously without blocking caller thread.

Declaration
public bool TryAcquire()
Returns
Type Description
Boolean

true if lock is taken successfuly; otherwise, false.

| Improve this Doc View Source

TryAcquire(TimeSpan)

Tries to enter the lock in exclusive mode asynchronously, with an optional time-out.

Declaration
public Task<bool> TryAcquire(TimeSpan timeout)
Parameters
Type Name Description
TimeSpan timeout

The interval to wait for the lock.

Returns
Type Description
Task<Boolean>

true if the caller entered exclusive mode; otherwise, false.

| Improve this Doc View Source

TryAcquire(TimeSpan, CancellationToken)

Tries to enter the lock in exclusive mode asynchronously, with an optional time-out.

Declaration
public Task<bool> TryAcquire(TimeSpan timeout, CancellationToken token)
Parameters
Type Name Description
TimeSpan timeout

The interval to wait for the lock.

CancellationToken token

The token that can be used to abort lock acquisition.

Returns
Type Description
Task<Boolean>

true if the caller entered exclusive mode; otherwise, false.

Implements

ISynchronizer

Extension Methods

AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, CancellationToken)
ExpressionBuilder.Const<T>(T)
ObjectExtensions.GetUserData<T>(T)
ObjectExtensions.IsOneOf<T>(T, IEnumerable<T>)
ObjectExtensions.IsOneOf<T>(T, T[])
ObjectExtensions.Decompose<T, R1, R2>(T, Func<T, R1>, Func<T, R2>, out R1, out R2)
ObjectExtensions.Decompose<T, R1, R2>(T, ValueFunc<T, R1>, ValueFunc<T, R2>, out R1, out R2)
ObjectExtensions.Decompose<T, R1, R2>(T, Func<T, R1>, Func<T, R2>)
ObjectExtensions.Decompose<T, R1, R2>(T, ValueFunc<T, R1>, ValueFunc<T, R2>)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX