Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WaitHandle Abstract

An object that waits for exclusive access to some shared resource.

Hierarchy

Implements

Index

Constructors

  • Initialzes the base WaitHandle object.

    throws

    MemoryRangeError memory is not large enough to store the wait handle data.

    Parameters

    • memory: Memory

      The Memory to use when performing the assocaited wait operations.

    • Optional initialValue: number

      The initial value of the wait handle.

    • Optional creationData: number

      Any arbitary data that derived implementations wish to store in the wait handle.

    Returns shared.WaitHandle

Properties

i32: any
memory: Memory

Accessors

  • get creationData(): number
  • Gets the arbitary data that was provided when the wait handle was created.

    Returns number

Methods

  • [InitializeFromMemorySymbol](memory: Memory): void
  • atomicCompareExchange(expectedValue: number, replacementValue: number): number
  • Replaces the current value of the wait handle only if that value first equals an expected value.

    Parameters

    • expectedValue: number

      The value to test the current wait handle value against.

    • replacementValue: number

      The new value if the current value of the wait handle equals expectedValue.

    Returns number

    The original value of the wait handle.

  • atomicLoad(): number
  • Returns the current value of the wait handle.

    Returns number

  • atomicNotify(count: number): number
  • Awakens a given number of sleeping worker threads that are blocked on the current wait handle.

    Parameters

    • count: number

      The number of sleeping worker threads to notify.

    Returns number

    The number of worker threads that were notified.

  • Blocks the current worker thread if the value of the wait handle is equal to a given value, and returns only when the wait handle value then changes, or the timeout period is exceeded.

    Parameters

    • value: number

      The value that will be tested against the current value of the wait handle.

    • Optional timeout: number

      An optional timeout in milliseconds to wait for the values to change.

    Returns AtomicWaitResult

  • onWaitSynchronously(timeoutMs: number): boolean
  • Performs an implementation specific wait operation that should block the current worker thread.

    remarks

    This method must be overriden by types that derive from WaitHandle in order to provide their specific wait semantics.

    virtual

    Parameters

    • timeoutMs: number

      The number of milliseconds to wait.

    Returns boolean

    true if the wait handle became signaled; false if the timeout period was exceeded.

  • waitSynchronously(): boolean
  • waitSynchronously(timeoutMs: number): boolean
  • Blocks the current worker thread indefinitely until the current WaitHandle receives a signal.

    throws

    InvalidOperationError The method was invoked on the main worker thread which cannot be blocked.

    Returns boolean

    true if the wait handle became signaled; false if the timeout period was exceeded.

  • Blocks the current worker thread until the current WaitHandle receives a signal using a timeout to specify the maximum number of milliseconds to wait.

    throws

    InvalidOperationError The method was invoked on the main worker thread which cannot be blocked.

    Parameters

    • timeoutMs: number

      The number of milliseconds to wait.

    Returns boolean

    true if the wait handle became signaled; false if the timeout period was exceeded.

Generated using TypeDoc