std-function
thread::sleep: block the current thread
Sleep blocks the calling thread. It may last longer than requested due to scheduling and platform granularity. Do not use sleep to establish worker ordering. This fixture uses a zero duration and makes no timing assertion. Expected stdout (not executed): continued Common mistake: Using a guessed sleep duration to make a race disappear.
Formal Syntax & Structure
rust syntaxrust
thread::sleep(duration: Duration)Working Example
Example Snippetrust
fn main() { std::thread::sleep(std::time::Duration::ZERO); println!("continued");}