A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://dotnet.github.io/dotNext/api/DotNext.Threading.AsyncExclusiveLock.html below:

Class AsyncExclusiveLock | .NEXT

Class AsyncExclusiveLock

Represents asynchronous mutually exclusive lock.

Inheritance

AsyncExclusiveLock

Namespace: DotNext.Threading Assembly: DotNext.Threading.dll Syntax
public class AsyncExclusiveLock : QueuedSynchronizer, IDisposable, IAsyncDisposable
Constructors | Edit this page View Source AsyncExclusiveLock()

Initializes a new asynchronous exclusive lock.

Declaration
public AsyncExclusiveLock()
| Edit this page View Source AsyncExclusiveLock(int)

Initializes a new asynchronous exclusive lock.

Declaration
public AsyncExclusiveLock(int concurrencyLevel)
Parameters Type Name Description int concurrencyLevel

The expected number of concurrent flows.

Exceptions Properties | Edit this page View Source IsLockHeld

Indicates that exclusive lock taken.

Declaration
public bool IsLockHeld { get; }
Property Value Methods | Edit this page View Source AcquireAsync(CancellationToken)

Enters the lock in exclusive mode asynchronously.

Declaration
public ValueTask AcquireAsync(CancellationToken token = default)
Parameters Type Name Description CancellationToken token

The token that can be used to abort lock acquisition.

Returns Type Description ValueTask

The task representing lock acquisition operation.

Exceptions | Edit this page View Source AcquireAsync(TimeSpan, CancellationToken)

Enters the lock in exclusive mode asynchronously.

Declaration
public ValueTask AcquireAsync(TimeSpan timeout, CancellationToken token = default)
Parameters Type Name Description TimeSpan timeout

The interval to wait for the lock.

CancellationToken token

The token that can be used to abort lock acquisition.

Returns Type Description ValueTask

The task representing lock acquisition operation.

Exceptions | Edit this page View Source Release()

Releases previously acquired exclusive lock.

Declaration Exceptions | Edit this page View Source StealAsync(object?, CancellationToken)

Interrupts all pending callers in the queue and acquires the lock.

Declaration
public ValueTask StealAsync(object? reason = null, CancellationToken token = default)
Parameters Type Name Description object reason

The reason for lock steal.

CancellationToken token

The token that can be used to abort lock acquisition.

Returns Type Description ValueTask

The task representing lock acquisition operation.

Exceptions See Also | Edit this page View Source StealAsync(object?, TimeSpan, CancellationToken)

Interrupts all pending callers in the queue and acquires the lock.

Declaration
public ValueTask StealAsync(object? reason, TimeSpan timeout, CancellationToken token = default)
Parameters Type Name Description object reason

The reason for lock steal.

TimeSpan timeout

The interval to wait for the lock.

CancellationToken token

The token that can be used to abort lock acquisition.

Returns Type Description ValueTask

The task representing lock acquisition operation.

Exceptions See Also | Edit this page View Source TryAcquire()

Attempts to obtain exclusive lock synchronously without blocking caller thread.

Declaration Returns Type Description bool

true if lock is taken successfully; otherwise, false.

Exceptions | Edit this page View Source TryAcquire(TimeSpan, CancellationToken)

Tries to acquire the lock synchronously.

Declaration
public bool TryAcquire(TimeSpan timeout, CancellationToken token = default)
Parameters Type Name Description TimeSpan timeout

The interval to wait for the lock.

CancellationToken token

The token that can be used to cancel the operation.

Returns Type Description bool

true if the lock is acquired in timely manner; false if canceled or timed out.

Exceptions | Edit this page View Source TryAcquireAsync(TimeSpan, CancellationToken)

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

Declaration
public ValueTask<bool> TryAcquireAsync(TimeSpan timeout, CancellationToken token = default)
Parameters Type Name Description TimeSpan timeout

The interval to wait for the lock.

CancellationToken token

The token that can be used to abort lock acquisition.

Returns Exceptions | Edit this page View Source TryStealAsync(object?, TimeSpan, CancellationToken)

Interrupts all pending callers in the queue and acquires the lock.

Declaration
public ValueTask<bool> TryStealAsync(object? reason, TimeSpan timeout, CancellationToken token = default)
Parameters Type Name Description object reason

The reason for lock steal.

TimeSpan timeout

The interval to wait for the lock.

CancellationToken token

The token that can be used to abort lock acquisition.

Returns Exceptions See Also Implements Extension Methods

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4