Class LockExtension
- Namespace
- DMediatR
- Assembly
- DMediatR.dll
public static class LockExtension
- Inheritance
-
LockExtension
- Inherited Members
Methods
Lock(ILock, SemaphoreSlim, CancellationToken)
Lock the given semaphore only once in a call chain to avoid deadlocks. It is the responsibility of the issuer of a message to relay the HasLocked HashSet of the ILockingMessage down to potentially recursive successive messages.
public static Task<bool> Lock(this ILock message, SemaphoreSlim semaphore, CancellationToken cancellationToken)
Parameters
message
ILocksemaphore
SemaphoreSlimSemaphoreSlim(1,1) object of the handler class.
cancellationToken
CancellationToken