Newly availableUseful in specialized shared-memory systems where blocking waits are unacceptable but low-level synchronization still matters.

Overview

Atomics.waitAsync() lets code wait on shared memory changes without blocking the main thread. It is designed for advanced concurrency patterns that need asynchronous coordination.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
90
90
145
16.4
90
16.4
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (90)
Implementation note
  • The `Atomics.waitAsync()` method never times out. See bug 40742782.
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (90)
Implementation note
  • The `Atomics.waitAsync()` method never times out. See bug 40742782.
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (90)
Implementation note
  • The `Atomics.waitAsync()` method never times out. See bug 40742782.

Syntax

JAVASCRIPT
const sab = new SharedArrayBuffer(4);
const int32 = new Int32Array(sab);

const { async: waitPromise } = Atomics.waitAsync(int32, 0, 0);
waitPromise.then(() => console.log('The value has been changed'));

Live demo

Check Atomics.waitAsync support

Inspect the availability of the async waiting API.

JavaScript
Output
Press the Run button

Start an async wait

Create the shared memory setup and inspect the returned wait token.

JavaScript
Output
Press the Run button

Resolve a waitAsync promise

Wake the waiting promise with Atomics.notify after updating the value.

JavaScript
Output
Press the Run button

Use cases

  • Async coordination

    Wait for shared-memory state changes without freezing the thread that requested the wait.

  • Worker orchestration

    Build advanced scheduling logic across workers while preserving non-blocking behavior.

Cautions

  • This remains low-level concurrency code, so use it only when simpler async primitives are insufficient.
  • Debugging async shared-memory coordination is still complex and requires disciplined testing.

Accessibility

  • Better non-blocking behavior can help keep the UI responsive when background processing is heavy.
  • Users still need visible progress and recovery states when concurrency-backed work takes time.

Powered by web-features