Skip to content

Commit 1e36e08

Browse files
committed
update platform-specific behaviour docs for sleep untill
1 parent d0a4d79 commit 1e36e08

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

library/std/src/thread/mod.rs

+28-2
Original file line numberDiff line numberDiff line change
@@ -880,8 +880,34 @@ pub fn sleep(dur: Duration) {
880880
///
881881
/// # Platform-specific behavior
882882
///
883-
/// This function uses [`sleep`] internally, see its platform-specific behaviour.
884-
///
883+
/// In most cases this function will an call OS specific function. Where that
884+
/// is not supported [`sleep`] is used. Those platforms are referred to as other
885+
/// in the table below.
886+
///
887+
/// # Underlying System calls
888+
///
889+
/// The following system calls are [currently] being used:
890+
///
891+
///
892+
/// | Platform | System call |
893+
/// |-----------|----------------------------------------------------------------------|
894+
/// | Linux | [clock_nanosleep] (Monotonic clock) |
895+
/// | BSD except OpenBSD | [clock_nanosleep] (Monotonic Clock)] |
896+
/// | Android | [clock_nanosleep] (Monotonic Clock)] |
897+
/// | Solaris | [clock_nanosleep] (Monotonic Clock)] |
898+
/// | Illumos | [clock_nanosleep] (Monotonic Clock)] |
899+
/// | Darwin | [mach_wait_until] |
900+
/// | WASI | [subscription_clock] |
901+
/// | Windows | [SetWaitableTimer] |
902+
/// | Other | `sleep_until` uses [`sleep`] and does not issue a syscall itself |
903+
///
904+
/// [currently]: crate::io#platform-specific-behavior
905+
/// [clock_nanosleep]: https://linux.die.net/man/3/clock_nanosleep
906+
/// [subscription_clock]: https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#-subscription_clock-record
907+
/// [mach_wait_until]: https://developer.apple.com/library/archive/technotes/tn2169/_index.html
908+
/// [SetWaitableTimer]: https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-setwaitabletimer
909+
///
910+
/// **Disclaimer:** These system calls might change over time.
885911
///
886912
/// # Examples
887913
///

0 commit comments

Comments
 (0)