Appearance
AcquireLockAsync Method
Definition
- Namespace:
JASE.Extensions - Assembly:
JASE.Concurrency.dll
Overloads
| Name | Description |
|---|---|
ValueTask<LockHandle> AcquireLockAsync(AsyncReaderWriterLock lock, LockType type, CancellationToken cancellationToken = null) | Acquires a lock of the requested type asynchronously. |
ValueTask<LockHandle> AcquireLockAsync(AsyncReaderWriterLock lock, LockType type, int timeoutMs, CancellationToken cancellationToken = null) | Acquires a lock of the requested type asynchronously, waiting at most timeoutMs. |
ValueTask<LockHandle> AcquireLockAsync(AsyncReaderWriterLock lock, LockType type, int timeoutMs, CancellationToken cancellationToken = null)
csharp
ValueTask<LockHandle> AcquireLockAsync(AsyncReaderWriterLock lock, LockType type, int timeoutMs, CancellationToken cancellationToken = null)Acquires a lock of the requested type asynchronously, waiting at most timeoutMs.
Parameters
| Name | Description |
|---|---|
cancellationToken | Token used to cancel the wait. |
lock | The lock instance. |
timeoutMs | Maximum wait in milliseconds. When zero or negative, LockEntranceTimeout is used. |
type | The lock type to acquire. |
Returns
A disposable handle that releases the lock.
ValueTask<LockHandle> AcquireLockAsync(AsyncReaderWriterLock lock, LockType type, CancellationToken cancellationToken = null)
csharp
ValueTask<LockHandle> AcquireLockAsync(AsyncReaderWriterLock lock, LockType type, CancellationToken cancellationToken = null)Acquires a lock of the requested type asynchronously.
Parameters
| Name | Description |
|---|---|
cancellationToken | Token used to cancel the wait. |
lock | The lock instance. |
type | The lock type to acquire. UpgradableRead is not supported. |
Returns
A disposable handle that releases the lock.