@@ -897,8 +897,33 @@ pub fn sleep(dur: Duration) {
897897///
898898/// # Platform-specific behavior
899899///
900- /// This function uses [`sleep`] internally, see its platform-specific behavior.
901- ///
900+ /// In most cases this function will call an OS specific function. Where that
901+ /// is not supported [`sleep`] is used. Those platforms are referred to as other
902+ /// in the table below.
903+ ///
904+ /// # Underlying System calls
905+ ///
906+ /// The following system calls are [currently] being used:
907+ ///
908+ /// | Platform | System call |
909+ /// |-----------|----------------------------------------------------------------------|
910+ /// | Linux | [clock_nanosleep] (Monotonic clock) |
911+ /// | BSD except OpenBSD | [clock_nanosleep] (Monotonic Clock)] |
912+ /// | Android | [clock_nanosleep] (Monotonic Clock)] |
913+ /// | Solaris | [clock_nanosleep] (Monotonic Clock)] |
914+ /// | Illumos | [clock_nanosleep] (Monotonic Clock)] |
915+ /// | Dragonfly | [clock_nanosleep] (Monotonic Clock)] |
916+ /// | Hurd | [clock_nanosleep] (Monotonic Clock)] |
917+ /// | Fuchsia | [clock_nanosleep] (Monotonic Clock)] |
918+ /// | Vxworks | [clock_nanosleep] (Monotonic Clock)] |
919+ /// | Other | `sleep_until` uses [`sleep`] and does not issue a syscall itself |
920+ ///
921+ /// [currently]: crate::io#platform-specific-behavior
922+ /// [clock_nanosleep]: https://linux.die.net/man/3/clock_nanosleep
923+ /// [subscription_clock]: https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#-subscription_clock-record
924+ /// [mach_wait_until]: https://developer.apple.com/library/archive/technotes/tn2169/_index.html
925+ ///
926+ /// **Disclaimer:** These system calls might change over time.
902927///
903928/// # Examples
904929///
@@ -923,9 +948,9 @@ pub fn sleep(dur: Duration) {
923948/// }
924949/// ```
925950///
926- /// A slow api we must not call too fast and which takes a few
951+ /// A slow API we must not call too fast and which takes a few
927952/// tries before succeeding. By using `sleep_until` the time the
928- /// api call takes does not influence when we retry or when we give up
953+ /// API call takes does not influence when we retry or when we give up
929954///
930955/// ```no_run
931956/// #![feature(thread_sleep_until)]
@@ -960,11 +985,7 @@ pub fn sleep(dur: Duration) {
960985/// ```
961986#[ unstable( feature = "thread_sleep_until" , issue = "113752" ) ]
962987pub fn sleep_until ( deadline : Instant ) {
963- let now = Instant :: now ( ) ;
964-
965- if let Some ( delay) = deadline. checked_duration_since ( now) {
966- sleep ( delay) ;
967- }
988+ imp:: Thread :: sleep_until ( deadline)
968989}
969990
970991/// Used to ensure that `park` and `park_timeout` do not unwind, as that can
0 commit comments