DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="5.0.0" />

 LockAcquisition

public static class LockAcquisition
Provides a set of methods to acquire different types of lock.
public static Holder AcquireReadLock<T>(this T obj)

Acquires read lock for the specified object.

public static Holder AcquireReadLock<T>(this T obj, TimeSpan timeout)

Acquires read lock for the specified object.

public static Holder AcquireUpgradeableReadLock<T>(this T obj)

Acquires upgradeable read lock for the specified object.

public static Holder AcquireUpgradeableReadLock<T>(this T obj, TimeSpan timeout)

Acquires upgradeable read lock for the specified object.

public static Holder AcquireWriteLock<T>(this T obj)

Acquires write lock for the specified object.

public static Holder AcquireWriteLock<T>(this T obj, TimeSpan timeout)

Acquires write lock for the specified object.