CountdownEvent Class

    Package: @esfx/threading-countdown
    Declaration
    export declare class CountdownEvent implements Disposable 

    Constructors

    constructor(initialCount)

    Constructs a new instance of the CountdownEvent class

    Declaration
    constructor(initialCount: number);
    Parameters
    initialCount
    number

    constructor(buffer, byteOffset)

    Constructs a new instance of the CountdownEvent class

    Declaration
    constructor(buffer: SharedArrayBuffer, byteOffset?: number);
    Parameters
    buffer
    SharedArrayBuffer

    byteOffset
    number

    Properties

    buffer

    Gets the SharedArrayBuffer for this object.

    Declaration
    get buffer(): SharedArrayBuffer;
    Property Value
    SharedArrayBuffer

    byteLength

    Gets the number of bytes occupied by this object in its buffer.

    Declaration
    get byteLength(): number;
    Property Value
    number

    byteOffset

    Gets the byte offset of this object in its buffer.

    Declaration
    get byteOffset(): number;
    Property Value
    number

    initialCount

    Gets the number of participants initially required to signal the event.

    Declaration
    get initialCount(): number;
    Property Value
    number

    isSet

    Gets a value indicating whether the event is signaled (all participants are accounted for).

    Declaration
    get isSet(): boolean;
    Property Value
    boolean

    remainingCount

    Gets the number of remaining participants required to signal the event.

    Declaration
    get remainingCount(): number;
    Property Value
    number

    SIZE

    Declaration
    static readonly SIZE = 12;

    Methods

    [Disposable.dispose]()

    Releases all resources for this object.

    Declaration
    [Disposable.dispose](): void;
    Returns
    void

    add(count)

    Adds one or more required participants to the event.

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

    Returns
    void

    close()

    Releases all resources for this object.

    Declaration
    close(): void;
    Returns
    void

    reset(count)

    Resets the countdown to the specified count.

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

    The new number of participants required. If this is undefined, the current value of initialCount is used.

    Returns
    void

    signal(count)

    Signals a participant is ready, decrementing the number of remaining required participants by the provided value.

    Declaration
    signal(count?: number): boolean;
    Parameters
    count
    number

    The number of participants to signal (default: 1).

    Returns
    boolean

    true if all participants were accounted for and the event became signaled; otherwise, false.

    tryAdd(count)

    Adds one or more required participants to the event if the event is not already signaled.

    Declaration
    tryAdd(count?: number): boolean;
    Parameters
    count
    number

    Returns
    boolean

    true if the participants were added; otherwise, false.

    wait(ms)

    Blocks the current thread until the countdown is set.

    Declaration
    wait(ms?: number): boolean;
    Parameters
    ms
    number

    The number of milliseconds to wait.

    Returns
    boolean

    true if the event was signaled before the timeout period elapsed; otherwise, false.

    Generated by DocFX