W3cubDocs

/Rust

Function std::hint::spin_loop

pub fn spin_loop()
🔬 This is a nightly-only experimental API. (renamed_spin_loop #55002)

Emits a machine instruction hinting to the processor that it is running in busy-wait spin-loop ("spin lock").

For a discussion of different locking strategies and their trade-offs, see core::sync::atomic::spin_loop_hint.

Note: On platforms that do not support receiving spin-loop hints this function does not do anything at all.

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/hint/fn.spin_loop.html