Atomics.isLockFree
The static Atomics.isLockFree() method is used to determine whether to use locks or atomic operations. It returns true, if the given size is one of the BYTES_PER_ELEMENT property of integer TypedArray types.
Syntax
Atomics.isLockFree(size)
Parameters
size - The size in bytes to check.
Return value
A Boolean indicating whether the operation is lock free.
Examples
Atomics.isLockFree(1); // true
Atomics.isLockFree(2); // true
Atomics.isLockFree(3); // false
Atomics.isLockFree(4); // true
Atomics.isLockFree(5); // false
Atomics.isLockFree(6); // false
Atomics.isLockFree(7); // false
Atomics.isLockFree(8); // false
Specifications
|
Desktop |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
| Basic support |
68
- 68
- 60 — 63
- Chrome disabled
SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place.
|
16
|
57 Disabled
- 57
Disabled
- Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog).
- 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.
- 55 — 57
- 46 — 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.
|
No |
No |
10.1 — ? |
|
Mobile |
|
Android webview |
Chrome for Android |
Edge Mobile |
Firefox for Android |
Opera for Android |
iOS Safari |
Samsung Internet |
| Basic support |
60 — 63
- 60 — 63
- 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.
|
60 — 63
- 60 — 63
- 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.
|
? |
57 Disabled
- 57
Disabled
- Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog).
- 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.
- 55 — 57
- 46 — 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.
|
No |
No |
No |
|
Server |
|
Node.js |
| Basic support |
8.10.0 |
See also