Skip to main content

pause_with_hint

Function pause_with_hint 

Source
pub fn pause_with_hint(duration_hint: u32)
Expand description

The static Atomics.pause() static method provides a micro-wait primitive that hints to the CPU that the caller is spinning while waiting on access to a shared resource. This allows the system to reduce the resources allocated to the core (such as power) or thread, without yielding the current thread.

pause() has no observable behavior other than timing. The exact behavior is dependent on the CPU architecture and the operating system. For example, in Intel x86, it may be a pause instruction as per Intel’s optimization manual. It could be a no-op in certain platforms.

This method is used to operate on a BigInt64Array or a BigUint64Array.

MDN documentation