AsyncSemaphore Class

    Package: @esfx/async-semaphore

    Limits the number of asynchronous operations that can access a resource or pool of resources.

    Declaration
    export declare class AsyncSemaphore 

    Constructors

    constructor(initialCount, maxCount)

    Initializes a new instance of the Semaphore class.

    Declaration
    constructor(initialCount: number, maxCount?: number);
    Parameters
    initialCount
    number

    The initial number of entries.

    maxCount
    number

    The maximum number of entries.

    Properties

    count

    Gets the number of remaining asynchronous operations that can enter the Semaphore.

    Declaration
    get count(): number;
    Property Value
    number

    Methods

    release(count)

    Releases the Semaphore one or more times.

    Declaration
    release(count?: number): void;
    Parameters
    count
    number

    The number of times to release the Semaphore.

    Returns
    void

    wait(cancelable)

    Asynchronously waits for the event to become signaled.

    Declaration
    wait(cancelable?: Cancelable): Promise<void>;
    Parameters
    cancelable
    Cancelable

    An optional Cancelable used to cancel the request.

    Returns
    Promise<void>

    Generated by DocFX