Show / Hide Table of Contents

Class AsyncLockAcquisition

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

Inheritance
Object
AsyncLockAcquisition
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public static class AsyncLockAcquisition : object

Methods

| Improve this Doc View Source

AcquireLockAsync<T>(T, CancellationToken)

Acquires exclusive lock associated with the given object.

Declaration
public static Task<AsyncLock.Holder> AcquireLockAsync<T>(this T obj, CancellationToken token)

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

CancellationToken token

The token that can be used to abort acquisition operation.

Returns
Type Description
Task<AsyncLock.Holder>

The acquired lock holder.

Type Parameters
Name Description
T

The type of the object to be locked.

| Improve this Doc View Source

AcquireLockAsync<T>(T, TimeSpan)

Acquires exclusive lock associated with the given object.

Declaration
public static Task<AsyncLock.Holder> AcquireLockAsync<T>(this T obj, TimeSpan timeout)

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

TimeSpan timeout

The interval to wait for the lock.

Returns
Type Description
Task<AsyncLock.Holder>

The acquired lock holder.

Type Parameters
Name Description
T

The type of the object to be locked.

| Improve this Doc View Source

AcquireReadLockAsync<T>(T, CancellationToken)

Acquires reader lock associated with the given object.

Declaration
public static Task<AsyncLock.Holder> AcquireReadLockAsync<T>(this T obj, CancellationToken token)

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

CancellationToken token

The token that can be used to abort acquisition operation.

Returns
Type Description
Task<AsyncLock.Holder>

The acquired lock holder.

Type Parameters
Name Description
T

The type of the object to be locked.

| Improve this Doc View Source

AcquireReadLockAsync<T>(T, TimeSpan)

Acquires reader lock associated with the given object.

Declaration
public static Task<AsyncLock.Holder> AcquireReadLockAsync<T>(this T obj, TimeSpan timeout)

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

TimeSpan timeout

The interval to wait for the lock.

Returns
Type Description
Task<AsyncLock.Holder>

The acquired lock holder.

Type Parameters
Name Description
T

The type of the object to be locked.

| Improve this Doc View Source

AcquireUpgradeableReadLockAsync<T>(T, CancellationToken)

Acquires upgradeable lock associated with the given object.

Declaration
public static Task<AsyncLock.Holder> AcquireUpgradeableReadLockAsync<T>(this T obj, CancellationToken token)

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

CancellationToken token

The token that can be used to abort acquisition operation.

Returns
Type Description
Task<AsyncLock.Holder>

The acquired lock holder.

Type Parameters
Name Description
T

The type of the object to be locked.

| Improve this Doc View Source

AcquireUpgradeableReadLockAsync<T>(T, TimeSpan)

Acquires upgradeable lock associated with the given object.

Declaration
public static Task<AsyncLock.Holder> AcquireUpgradeableReadLockAsync<T>(this T obj, TimeSpan timeout)

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

TimeSpan timeout

The interval to wait for the lock.

Returns
Type Description
Task<AsyncLock.Holder>

The acquired lock holder.

Type Parameters
Name Description
T

The type of the object to be locked.

| Improve this Doc View Source

AcquireWriteLockAsync<T>(T, CancellationToken)

Acquires reader lock associated with the given object.

Declaration
public static Task<AsyncLock.Holder> AcquireWriteLockAsync<T>(this T obj, CancellationToken token)

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

CancellationToken token

The token that can be used to abort acquisition operation.

Returns
Type Description
Task<AsyncLock.Holder>

The acquired lock holder.

Type Parameters
Name Description
T

The type of the object to be locked.

| Improve this Doc View Source

AcquireWriteLockAsync<T>(T, TimeSpan)

Acquires writer lock associated with the given object.

Declaration
public static Task<AsyncLock.Holder> AcquireWriteLockAsync<T>(this T obj, TimeSpan timeout)

    where T : class
Parameters
Type Name Description
T obj

The object to be locked.

TimeSpan timeout

The interval to wait for the lock.

Returns
Type Description
Task<AsyncLock.Holder>

The acquired lock holder.

Type Parameters
Name Description
T

The type of the object to be locked.

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