← Back to release summary

Atomics.waitAsync

Category
JavaScript
Type
New or changed feature
Status
Enabled by default (Chrome 87)
Intent stage
Shipped

Summary

Adds Atomics.waitAsync, the async version of Atomics.wait. Atomics.waitAsync allows programmers to wait on a SharedArrayBuffer location in the same fashion as Atomics.wait but returns a Promise instead.

Motivation

Atomics.wait blocks the thread and cannot be used on the main web browser thread, where blocking is disallowed. This makes coordination via SharedArrayBuffers between the main thread and worker threads more ergonomic.

Standards & signals

Docs: https://docs.google.com/document/d/1dthXsVHMc1Sd_oYf9a-KZSFOd_a8dUgnt4REAG8YIXA/edit?usp=sharing https://docs.google.com/document/d/1aeEGDm1XSqoJkQQKz9F75WqnuAa2caktxGy_O_KpO9Y/edit?usp=sharing

Explainers: https://github.com/tc39/proposal-atomics-wait-async/blob/master/PROPOSAL.md

View on chromestatus.com