The Atomics.wait() static method verifies that a shared memory location contains a given value and if so sleeps, awaiting a wake-up notification or a time out. It returns a string which is "not-equal" if the memory location does not match the given value, "ok" if woken by Atomics.notify(), or "timed-out" if the timeout expires.
Atomics.wait() and Atomics.notify() are used together to enable thread synchronization based on a value in shared memory. A thread can proceed immediately if the synchronization value has changed, or it can wait for notification from another thread when it reaches the synchronization point.
This method only works with an Int32Array or BigInt64Array that views a SharedArrayBuffer. It is blocking and cannot be used in the main thread. For a non-blocking, asynchronous version of this method, see Atomics.waitAsync().