静态
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.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Atomics.isLockFree(size)
size
The size in bytes to check.
A
布尔
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); // true
| 规范 |
|---|
|
ECMAScript (ECMA-262)
The definition of 'Atomics.isLockFree' in that specification. |
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
isLockFree
|
Chrome
68
|
Edge
79
|
Firefox
78
|
IE No | Opera No | Safari 10.1 — 11.1 |
WebView Android
60 — 63
|
Chrome Android
60 — 63
|
Firefox Android
57
Disabled
|
Opera Android No | Safari iOS 10.3 — 11.3 |
Samsung Internet Android
No
|
nodejs 8.10.0 |
完整支持
不支持
见实现注意事项。
用户必须明确启用此特征。
Atomics
Object
Object.prototype.__defineGetter__()
Object.prototype.__defineSetter__()
Object.prototype.__lookupGetter__()
Object.prototype.__lookupSetter__()
Object.prototype.hasOwnProperty()
Object.prototype.isPrototypeOf()
Object.prototype.propertyIsEnumerable()
Object.prototype.toLocaleString()
Object.prototype.toSource()
Object.prototype.toString()
Object.prototype.valueOf()
Object.setPrototypeOf()