Show / Hide Table of Contents

Class LockAcquisition

Provides a set of methods to acquire different types of lock.

Inheritance
Object
LockAcquisition
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext.Threading
Assembly: DotNext.dll
Syntax
public static class LockAcquisition

Methods

| Improve this Doc View Source

AcquireReadLock<T>(T)

Acquires read lock for the specified object.

Declaration
public static Lock.Holder AcquireReadLock<T>(this T obj)

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

Returns
Type Description
Lock.Holder

The acquired read lock.

Type Parameters
Name Description
T

The type of the object to be locked.

| Improve this Doc View Source

AcquireReadLock<T>(T, TimeSpan)

Acquires read lock for the specified object.

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

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

TimeSpan timeout

The amount of time to wait for the lock.

Returns
Type Description
Lock.Holder

The acquired read lock.

Type Parameters
Name Description
T

The type of the object to be locked.

Exceptions
Type Condition
TimeoutException

The lock cannot be acquired during the specified amount of time.

| Improve this Doc View Source

AcquireUpgradeableReadLock<T>(T)

Acquires upgradeable read lock for the specified object.

Declaration
public static Lock.Holder AcquireUpgradeableReadLock<T>(this T obj)

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

Returns
Type Description
Lock.Holder

The acquired upgradeable read lock.

Type Parameters
Name Description
T

The type of the object to be locked.

| Improve this Doc View Source

AcquireUpgradeableReadLock<T>(T, TimeSpan)

Acquires upgradeable read lock for the specified object.

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

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

TimeSpan timeout

The amount of time to wait for the lock.

Returns
Type Description
Lock.Holder

The acquired upgradeable read lock.

Type Parameters
Name Description
T

The type of the object to be locked.

Exceptions
Type Condition
TimeoutException

The lock cannot be acquired during the specified amount of time.

| Improve this Doc View Source

AcquireWriteLock<T>(T)

Acquires write lock for the specified object.

Declaration
public static Lock.Holder AcquireWriteLock<T>(this T obj)

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

Returns
Type Description
Lock.Holder

The acquired write lock.

Type Parameters
Name Description
T

The type of the object to be locked.

| Improve this Doc View Source

AcquireWriteLock<T>(T, TimeSpan)

Acquires write lock for the specified object.

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

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

TimeSpan timeout

The amount of time to wait for the lock.

Returns
Type Description
Lock.Holder

The acquired write lock.

Type Parameters
Name Description
T

The type of the object to be locked.

Exceptions
Type Condition
TimeoutException

The lock cannot be acquired during the specified amount of time.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX