mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-28 03:07:24 +03:00
f1922ffe3b
std: implement `sleep_until` on Apple platforms On Apple platforms, `nanosleep` is internally [implemented](https://github.com/apple-oss-distributions/Libc/blob/55b54c0a0c37b3b24393b42b90a4c561d6c606b1/gen/nanosleep.c#L281) using `mach_wait_until`, a function that waits until a deadline specified in terms of `mach_absolute_time`. Since `mach_wait_until` is [public](https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/osfmk/mach/mach_time.h#L50-L51)[^1], we can use it to implement `sleep_until` by converting `Instant`s (which are measured against `CLOCK_UPTIME_RAW`, which is equivalent to `mach_absolute_time`) into `mach_absolute_time` values. Related tracking issue: https://github.com/rust-lang/rust/issues/113752 [^1]: It's badly documented, but it's defined in the same header as `mach_absolute_time`, which `std` used to use for `Instant` before rust-lang/rust#116238.
This directory contains some source code for the Rust project, including:
- The bootstrapping build system
- Various submodules for tools, like cargo, tidy, etc.
For more information on how various parts of the compiler work, see the rustc dev guide.