Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Atomics

Hierarchy

  • Atomics

Index

Properties

[Symbol.toStringTag]

[Symbol.toStringTag]: "Atomics"

Methods

add

  • Adds a value to the value at the given position in the array, returning the original value. Until this atomic operation completes, any other read or write operation against the array will block.

    Parameters

    Returns number

and

  • Stores the bitwise AND of a value with the value at the given position in the array, returning the original value. Until this atomic operation completes, any other read or write operation against the array will block.

    Parameters

    Returns number

compareExchange

  • Replaces the value at the given position in the array if the original value equals the given expected value, returning the original value. Until this atomic operation completes, any other read or write operation against the array will block.

    Parameters

    Returns number

exchange

  • Replaces the value at the given position in the array, returning the original value. Until this atomic operation completes, any other read or write operation against the array will block.

    Parameters

    Returns number

isLockFree

  • isLockFree(size: number): boolean
  • Returns a value indicating whether high-performance algorithms can use atomic operations (true) or must use locks (false) for the given number of bytes-per-element of a typed array.

    Parameters

    • size: number

    Returns boolean

load

  • Returns the value at the given position in the array. Until this atomic operation completes, any other read or write operation against the array will block.

    Parameters

    Returns number

notify

  • notify(typedArray: Int32Array, index: number, count: number): number
  • Wakes up sleeping agents that are waiting on the given index of the array, returning the number of agents that were awoken.

    Parameters

    • typedArray: Int32Array
    • index: number
    • count: number

    Returns number

or

  • Stores the bitwise OR of a value with the value at the given position in the array, returning the original value. Until this atomic operation completes, any other read or write operation against the array will block.

    Parameters

    Returns number

store

  • Stores a value at the given position in the array, returning the new value. Until this atomic operation completes, any other read or write operation against the array will block.

    Parameters

    Returns number

sub

  • Subtracts a value from the value at the given position in the array, returning the original value. Until this atomic operation completes, any other read or write operation against the array will block.

    Parameters

    Returns number

wait

  • wait(typedArray: Int32Array, index: number, value: number, timeout?: undefined | number): "ok" | "not-equal" | "timed-out"
  • If the value at the given position in the array is equal to the provided value, the current agent is put to sleep causing execution to suspend until the timeout expires (returning "timed-out") or until the agent is awoken (returning "ok"); otherwise, returns "not-equal".

    Parameters

    • typedArray: Int32Array
    • index: number
    • value: number
    • Optional timeout: undefined | number

    Returns "ok" | "not-equal" | "timed-out"

xor

  • Stores the bitwise XOR of a value with the value at the given position in the array, returning the original value. Until this atomic operation completes, any other read or write operation against the array will block.

    Parameters

    Returns number