Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions library/std/src/thread/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ pub fn yield_now() {
imp::yield_now()
}

/// Determines whether the current thread is unwinding because of panic.
/// Determines whether the current thread is panicking.
///
/// Note that this returns `true` both when the thread is unwinding due to a
/// panic or executing a panic hook. The latter case will still happen when
Comment on lines +173 to +174
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns true when the thread is either unwinding due to a panic, or when it is executing a panic hook. Note that the latter case ...

Minor rewording suggestion to move the "note" bit to the second sentence since it's more of a note, and slightly smooth out the first sentence.

Please squash commits after this then LGTM, thanks for the additional fixes

/// `panic=abort` is set.
///
/// A common use of this feature is to poison shared resources when writing
/// unsafe code, by checking `panicking` when the `drop` is called.
Expand Down Expand Up @@ -309,14 +313,14 @@ pub fn sleep(dur: Duration) {
///
/// | Platform | System call |
/// |-----------|----------------------------------------------------------------------|
/// | Linux | [clock_nanosleep] (Monotonic clock) |
/// | BSD except OpenBSD | [clock_nanosleep] (Monotonic Clock)] |
/// | Android | [clock_nanosleep] (Monotonic Clock)] |
/// | Solaris | [clock_nanosleep] (Monotonic Clock)] |
/// | Illumos | [clock_nanosleep] (Monotonic Clock)] |
/// | Dragonfly | [clock_nanosleep] (Monotonic Clock)] |
/// | Hurd | [clock_nanosleep] (Monotonic Clock)] |
/// | Vxworks | [clock_nanosleep] (Monotonic Clock)] |
/// | Linux | [clock_nanosleep] (Monotonic Clock) |
/// | BSD except OpenBSD | [clock_nanosleep] (Monotonic Clock) |
/// | Android | [clock_nanosleep] (Monotonic Clock) |
/// | Solaris | [clock_nanosleep] (Monotonic Clock) |
/// | Illumos | [clock_nanosleep] (Monotonic Clock) |
/// | Dragonfly | [clock_nanosleep] (Monotonic Clock) |
/// | Hurd | [clock_nanosleep] (Monotonic Clock) |
/// | Vxworks | [clock_nanosleep] (Monotonic Clock) |
/// | Apple | `mach_wait_until` |
/// | Other | `sleep_until` uses [`sleep`] and does not issue a syscall itself |
///
Expand Down
Loading