Skip to main content

sleep

Function sleep 

Source
pub fn sleep<T: TryInto<u64>>(ms: T)
Expand description

Blocks the current thread for the specified duration.

§Arguments

  • ms - Duration to sleep in milliseconds, of any integer type; a negative duration is no wait

§Note

This blocks the entire thread. For async code, use tokio::time::sleep instead to avoid blocking the executor.

§Example

use logicaffeine_system::time;

time::sleep(500); // Sleep for half a second