LockHandle<TMutex> Interface
Package: @esfx/async-lockable
An object used to release a held lock.
Declaration
export interface LockHandle<TMutex extends AsyncLockable = AsyncLockable> extends Disposable, AsyncLockable
Properties
mutex
Gets the associated AsyncLockable
object.
Declaration
readonly mutex: TMutex;
Property Value
TMutex
ownsLock
Indicates whether this handle owns its associated mutex
.
Declaration
readonly ownsLock: boolean;
Property Value
Methods
lock(cancelable)
Reacquires the lock. If this handle already owns the lock, an Error
is thrown.
Declaration
lock(cancelable?: Cancelable): Promise<this>;
Parameters
Returns
Promise<this>
unlock()
Releases the lock. If this handle does not own the lock, an Error
is thrown.
Declaration
unlock(): void;
Returns
void