Creates a new async-compatible mutual exclusion lock.
AsyncLock(IAsyncWaitQueue<IDisposable> queue)
Creates a new async-compatible mutual exclusion lock using the specified wait queue.
Parameters
Name
Description
queue
The wait queue used to manage waiters.
Properties
Id
Gets a semi-unique identifier for this asynchronous lock.
IsTaken
Gets a value indicating whether this lock is taken.
Methods
Lock()
Synchronously acquires the lock. Returns a disposable that releases the lock when disposed. This method may block the calling thread.
Lock(CancellationToken cancellationToken)
Synchronously acquires the lock. Returns a disposable that releases the lock when disposed. This method may block the calling thread.
Parameters
Name
Description
cancellationToken
The cancellation token used to cancel the lock. If this is already set, then this method will attempt to take the lock immediately (succeeding if the lock is currently available).
LockAsync()
Asynchronously acquires the lock. Returns a disposable that releases the lock when disposed.
Returns
A disposable that releases the lock when disposed.
LockAsync(CancellationToken cancellationToken)
Asynchronously acquires the lock. Returns a disposable that releases the lock when disposed.
Parameters
Name
Description
cancellationToken
The cancellation token used to cancel the lock. If this is already set, then this method will attempt to take the lock immediately (succeeding if the lock is currently available).
Returns
A disposable that releases the lock when disposed.
Have a question about Catel? Use StackOverflow with the Catel tag!