The Atomics object provides atomic operations as static methods. They are used with SharedArrayBuffer objects.

The Atomic operations are installed on an Atomics module. Unlike the other global objects, Atomics is not a constructor. You cannot use it with a new operator or invoke the Atomics object as a function. All properties and methods of Atomics are static (as is the case with the Math object, for example).

Properties

Atomics[Symbol.toStringTag]

The value of this property is "Atomics".

Methods

Atomic operations

When memory is shared, multiple threads can read and write the same data in memory. Atomic operations make sure that predictable values are written and read, that operations are finished before the next operation starts and that operations are not interrupted.

Computes a bitwise XOR on the value at the specified index of the array with the provided value. Returns the old value at that index.

Wait and notify

The wait() and notify() methods are modeled on Linux futexes ("fast user-space mutex") and provide ways for waiting until a certain condition becomes true and are typically used as blocking constructs.

Verifies that the specified index of the array still contains a value and sleeps awaiting or times out. Returns either "ok", "not-equal", or "timed-out". If waiting is not allowed in the calling agent then it throws an Error exception (most browsers will not allow wait() on the browser's main thread).

An optimization primitive that can be used to determine whether to use locks or atomic operations. Returns true, if an atomic operation on arrays of the given element size will be implemented using a hardware atomic operation (as opposed to a lock). Experts only.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

WebView AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Chrome AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

WebView AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Chrome AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

WebView AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Chrome AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

WebView AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Chrome AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

WebView AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Chrome AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

WebView AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Chrome AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

WebView AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Chrome AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support48 — 55

Disabled

Disabled From version 48 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support46 — 48

NotesAlternate NameDisabled

Notes The count parameter defaults to 0 instead of the later-specified +Infinity.

Alternate Name Uses the non-standard name: futexWake

Disabled From version 46 until version 48 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

Alternate Name

No support10.1 — ?

Alternate Name

Alternate Name Uses the non-standard name: wake

WebView AndroidNo support60 — 63

NotesAlternate Name

No support60 — 63

NotesAlternate Name

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Alternate Name Uses the non-standard name: wake

Chrome AndroidNo support60 — 63

NotesAlternate Name

No support60 — 63

NotesAlternate Name

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support48 — 55

Disabled

Disabled From version 48 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support46 — 48

NotesAlternate NameDisabled

Notes The count parameter defaults to 0 instead of the later-specified +Infinity.

Alternate Name Uses the non-standard name: futexWake

Disabled From version 46 until version 48 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

WebView AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Chrome AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

WebView AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Chrome AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

WebView AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Chrome AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support48 — 55

Disabled

Disabled From version 48 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 46 until version 48 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

WebView AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Chrome AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support48 — 55

Disabled

Disabled From version 48 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 46 until version 48 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IENo support
No

OperaNo support
No

SafariNo support10.1 — ?

WebView AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Chrome AndroidNo support60 — 63

Notes

No support60 — 63

Notes

Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place.

Disabled From version 57: this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

No support55 — 57

No support46 — 55

Disabled

Disabled From version 46 until version 55 (exclusive): this feature is behind the javascript.options.shared_memory preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Opera AndroidNo support
No

Safari iOSNo support
No

Samsung Internet AndroidNo support
No

nodejsFull support
8.10.0

Legend

Full support

Full support

No support

No support

Compatibility unknown

Compatibility unknown

See implementation notes.

See implementation notes.

User must explicitly enable this feature.

User must explicitly enable this feature.

Uses a non-standard name.

Uses a non-standard name.

Compatibility notes

Prior to Firefox 48, the latest API names and semantics weren't implemented yet. The changes between Firefox version 46 and version 48 are:

The methods Atomics.futexWakeOrRequeue() and Atomics.fence() are now removed entirely (bug 1259544 and bug 1225028).

The methods Atomics.wait() and Atomics.wake() were named Atomics.futexWait() and Atomics.futexWake() (bug 1260910). Note: The old names have been removed in version 49 and later (bug 1262062). Atomics.wake() has then been renamed to Atomics.notify() in version 63.

The properties Atomics.OK, Atomics.TIMEDOUT, Atomics.NOTEQUAL have been removed. The Atomics.wait() method now returns the strings "ok", "timed-out" and "not-equal" (bug 1260835).