Open sandboxFocus

Interface ILockHandle

Allows acquiring and releasing a named lock returned by GetLock(string).

Namespace: PostSharp.Patterns.Caching.Locking
Assembly: PostSharp.Patterns.Caching.dll
Syntax
public interface ILockHandle : IDisposable
Remarks

The caching aspect can call Acquire(TimeSpan, CancellationToken) or AcquireAsync(TimeSpan, CancellationToken) twice on the same handle: first with a zero timeout and, if the lock is not free, with AcquireLockTimeout. It then always calls Release() or ReleaseAsync() and Dispose(), including when the lock could not be acquired. Implementations must therefore ignore a release of a lock that the handle does not hold.

Methods

Name Description
Acquire(TimeSpan, CancellationToken)

Synchronously acquires the lock bound to the current handle.

AcquireAsync(TimeSpan, CancellationToken)

Asynchronously acquires the lock bound to the current handle.

Release()

Synchronously releases the lock bound to the current handle.

ReleaseAsync()

Asynchronously releases the lock bound to the current handle.

See Also