Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SharedEventWaitHandle

A shared thread synchronization event.

Hierarchy

Implements

Index

Constructors

  • Initializes a new instance of SharedEventWaitHandle specifying whether the wait handle is initially signaled, and whether it should reset automatically or manually.

    Parameters

    • initialState: boolean

      true to set the initial state to signaled; false to unsignaled.

    • mode: EventResetMode

      An EventResetMode value that determines whether the event resets automatically or manually.

    • Optional memory: Memory

      The Memory to use when performing the synchronization operations.

    Returns SharedEventWaitHandle

Properties

memory: Memory
signaled: any
unsignaled: any

Accessors

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

    Returns number

  • get mode(): any
  • Gets the mode determining if the event resets automatically or manually.

    Returns any

    An EventResetMode value.

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
  • Overrides WaitHandle.onWaitSynchronously(...) to wait for the underlying wait handle to become signaled.

    override

    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.

  • reset(): boolean
  • Sets the state of the event to nonsignaled, causing worker threads to block.

    Returns boolean

    true if the operation succeeded; otherwise false.

  • set(): boolean
  • Sets the state of the event to signaled, allowing one or more blocked worker threads to proceed.

    Returns boolean

    true if the operation succeeded; otherwise false.

  • 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