Standard built-ins
Atomics.load()
Reads an integer element atomically. Use a shared buffer for communication between agents; the example checks operation semantics in Node.js, not inter-thread ordering.
Formal Syntax & Structure
javascript syntaxjavascript
Atomics.load(typedArray, index)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| typedArray | integer TypedArray | Integer view; floating-point and clamped arrays are not accepted. |
| index | number | Element index, not byte offset. |
Return Value
number | bigint
Current value.
Working Example
Example Snippetjavascript
const a=new Int32Array(new SharedArrayBuffer(4)); a[0]=12; console.log(Atomics.load(a,0));