AsyncMutex Class

    Package: @esfx/async-mutex

    An async coordination primitive used to coordinate access to a protected resource.

    Declaration
    export declare class AsyncMutex implements AsyncLockable 

    Properties

    [Symbol.toStringTag]

    Declaration
    [Symbol.toStringTag]: string;
    Property Value
    string

    isLocked

    Indicates whether the lock has been taken.

    Declaration
    get isLocked(): boolean;
    Property Value
    boolean

    Methods

    [AsyncLockable.lock](cancelable)

    Declaration
    [AsyncLockable.lock](cancelable?: Cancelable): Promise<LockHandle<AsyncMutex>>;
    Parameters
    cancelable
    Cancelable

    Returns
    Promise<LockHandle<AsyncMutex>>

    [AsyncLockable.unlock]()

    Declaration
    [AsyncLockable.unlock](): void;
    Returns
    void

    lock(cancelable)

    Asynchronously waits for the lock to become available and then takes the lock.

    Declaration
    lock(cancelable?: Cancelable): Promise<LockHandle<AsyncMutex>>;
    Parameters
    cancelable
    Cancelable

    A Cancelable used to cancel the pending request.

    Returns
    Promise<LockHandle<AsyncMutex>>

    tryLock()

    Synchronously tries to take a lock.

    Declaration
    tryLock(): boolean;
    Returns
    boolean

    unlock()

    Releases the lock.

    Declaration
    unlock(): boolean;
    Returns
    boolean

    Generated by DocFX