18 public static async ValueTask<SemaphoreSlimContext>
Lock(SemaphoreSlim semaphore, CancellationToken cancellationToken)
Async lock context helper.
static async ValueTask< SemaphoreSlimContext > Lock(SemaphoreSlim semaphore, CancellationToken cancellationToken)
Asyncronously locks a semaphore .
SemaphoreSlimContext(SemaphoreSlim lockedSemaphore)
Initializes a new instance of the SemaphoreSlimContext class.
static SemaphoreSlimContext TryLock(SemaphoreSlim semaphore, out bool locked)
Asyncronously attempts to lock a semaphore .
readonly SemaphoreSlim lockedSemaphore
The locked SemaphoreSlim.
void Dispose()
Release the lock on lockedSemaphore.