ConditionVariable Class

    Package: @esfx/threading-conditionvariable
    Declaration
    export declare class ConditionVariable implements Disposable 

    Constructors

    constructor(buffer, byteOffset)

    Constructs a new instance of the ConditionVariable 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

    SIZE

    Declaration
    static readonly SIZE = 4;

    Methods

    [Disposable.dispose]()

    Releases the resources associated for this object.

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

    close()

    Releases the resources associated for this object.

    Declaration
    close(): void;
    Returns
    void

    notifyAll()

    Notifies all waiting threads.

    Declaration
    notifyAll(): number;
    Returns
    number

    The number of threads notified.

    notifyOne()

    Notifies one waiting thread.

    Declaration
    notifyOne(): boolean;
    Returns
    boolean

    true if a thread was notified; otherwise, false.

    wait(mutex, condition)

    Blocks the current thread until the condition variable is notified.

    Declaration
    wait(mutex: Lockable, condition?: () => boolean): boolean;
    Parameters
    mutex
    Lockable

    A lock used to synchronize access to the condition variable.

    condition
    () => boolean

    An optional condition to wait for.

    Returns
    boolean

    true if the condition variable was notified; otherwise, false.

    waitFor(mutex, ms, condition)

    Blocks the current thread until the condition variable is notified or after the specified timeout has elapsed.

    Declaration
    waitFor(mutex: Lockable, ms: number, condition?: () => boolean): boolean;
    Parameters
    mutex
    Lockable

    A lock used to synchronize access to the condition variable.

    ms
    number

    The number of milliseconds to wait.

    condition
    () => boolean

    An optional condition to wait for.

    Returns
    boolean

    true if the condition variable was notified prior to the timeout period elapsing; otherwise, false.

    Generated by DocFX