DotNext.Threading by Roman Sakno

<PackageReference Include="DotNext.Threading" Version="0.10.0" />

 AsyncExclusiveLock

Represents asynchronous mutually exclusive lock.
public bool IsLockHeld { get; }

Indicates that exclusive lock taken.

public Task Acquire(TimeSpan timeout)

Enters the lock in exclusive mode asynchronously.

Enters the lock in exclusive mode asynchronously.

public void Release()

Releases previously acquired exclusive lock.

public Task<bool> TryAcquire(TimeSpan timeout, CancellationToken token)

Tries to enter the lock in exclusive mode asynchronously, with an optional time-out.

public Task<bool> TryAcquire(TimeSpan timeout)

Tries to enter the lock in exclusive mode asynchronously, with an optional time-out.