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.
readonly SemaphoreSlim lockedSemaphore
The locked SemaphoreSlim.
static ? SemaphoreSlimContext TryLock(SemaphoreSlim semaphore, out bool locked)
Asyncronously attempts to lock a semaphore .
void Dispose()
Release the lock on lockedSemaphore.