Skip to content

Commit

Permalink
Rollup merge of rust-lang#54646 - vn971:fix_std_thread_sleep, r=frewsxcv
Browse files Browse the repository at this point in the history
improve documentation on std::thread::sleep
  • Loading branch information
kennytm committed Oct 18, 2018
2 parents f7eb7fb + 7a0fa95 commit e4ac447
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/libstd/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,15 +650,17 @@ pub fn panicking() -> bool {
panicking::panicking()
}

/// Puts the current thread to sleep for the specified amount of time.
/// Puts the current thread to sleep for at least the specified amount of time.
///
/// The thread may sleep longer than the duration specified due to scheduling
/// specifics or platform-dependent functionality.
/// specifics or platform-dependent functionality. It will never sleep less.
///
/// # Platform-specific behavior
///
/// On Unix platforms this function will not return early due to a
/// signal being received or a spurious wakeup.
/// On Unix platforms, the underlying syscall may be interrupted by a
/// spurious wakeup or signal handler. To ensure the sleep occurs for at least
/// the specified duration, this function may invoke that system call multiple
/// times.
///
/// # Examples
///
Expand All @@ -674,17 +676,19 @@ pub fn sleep_ms(ms: u32) {
sleep(Duration::from_millis(ms as u64))
}

/// Puts the current thread to sleep for the specified amount of time.
/// Puts the current thread to sleep for at least the specified amount of time.
///
/// The thread may sleep longer than the duration specified due to scheduling
/// specifics or platform-dependent functionality.
/// specifics or platform-dependent functionality. It will never sleep less.
///
/// # Platform-specific behavior
///
/// On Unix platforms this function will not return early due to a
/// signal being received or a spurious wakeup. Platforms which do not support
/// nanosecond precision for sleeping will have `dur` rounded up to the nearest
/// granularity of time they can sleep for.
/// On Unix platforms, the underlying syscall may be interrupted by a
/// spurious wakeup or signal handler. To ensure the sleep occurs for at least
/// the specified duration, this function may invoke that system call multiple
/// times.
/// Platforms which do not support nanosecond precision for sleeping will
/// have `dur` rounded up to the nearest granularity of time they can sleep for.
///
/// # Examples
///
Expand Down

0 comments on commit e4ac447

Please sign in to comment.