@@ -650,15 +650,17 @@ pub fn panicking() -> bool {
650
650
panicking:: panicking ( )
651
651
}
652
652
653
- /// Puts the current thread to sleep for the specified amount of time.
653
+ /// Puts the current thread to sleep for at least the specified amount of time.
654
654
///
655
655
/// The thread may sleep longer than the duration specified due to scheduling
656
- /// specifics or platform-dependent functionality.
656
+ /// specifics or platform-dependent functionality. It will never sleep less.
657
657
///
658
658
/// # Platform-specific behavior
659
659
///
660
- /// On Unix platforms this function will not return early due to a
661
- /// signal being received or a spurious wakeup.
660
+ /// On Unix platforms, the underlying syscall may be interrupted by a
661
+ /// spurious wakeup or signal handler. To ensure the sleep occurs for at least
662
+ /// the specified duration, this function may invoke that system call multiple
663
+ /// times.
662
664
///
663
665
/// # Examples
664
666
///
@@ -674,17 +676,19 @@ pub fn sleep_ms(ms: u32) {
674
676
sleep ( Duration :: from_millis ( ms as u64 ) )
675
677
}
676
678
677
- /// Puts the current thread to sleep for the specified amount of time.
679
+ /// Puts the current thread to sleep for at least the specified amount of time.
678
680
///
679
681
/// The thread may sleep longer than the duration specified due to scheduling
680
- /// specifics or platform-dependent functionality.
682
+ /// specifics or platform-dependent functionality. It will never sleep less.
681
683
///
682
684
/// # Platform-specific behavior
683
685
///
684
- /// On Unix platforms this function will not return early due to a
685
- /// signal being received or a spurious wakeup. Platforms which do not support
686
- /// nanosecond precision for sleeping will have `dur` rounded up to the nearest
687
- /// granularity of time they can sleep for.
686
+ /// On Unix platforms, the underlying syscall may be interrupted by a
687
+ /// spurious wakeup or signal handler. To ensure the sleep occurs for at least
688
+ /// the specified duration, this function may invoke that system call multiple
689
+ /// times.
690
+ /// Platforms which do not support nanosecond precision for sleeping will
691
+ /// have `dur` rounded up to the nearest granularity of time they can sleep for.
688
692
///
689
693
/// # Examples
690
694
///
0 commit comments