Function spin_sleep::native_sleep

source ·
pub fn native_sleep(duration: Duration)
Expand description

Asks the OS to put the current thread to sleep for at least the specified amount of time. Does not spin.

Equivalent to std::thread::sleep, with the following exceptions:

  • Windows (>= Windows 10, version 1803): Uses a high resolution waitable timer, similar to std in rust >= 1.75.
  • Windows (< Windows 10, version 1803): Automatically selects the best native sleep accuracy generally achieving ~1ms native sleep accuracy, instead of default ~16ms.