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.
Atomics.isLockFree(size)
size
A Boolean
indicating whether the operation is lock free.
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
Specification | Status | Comment |
---|---|---|
ECMAScript Latest Draft (ECMA-262) The definition of 'Atomics.isLockFree' in that specification. | Draft | Initial definition in ES2017. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 68
|
16
|
57
|
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
|
? | 57
|
No | No | No |
Server | |
---|---|
Node.js | |
Basic support | 8.10.0 |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/isLockFree