Unnamed repository; edit this file 'description' to name the repository.
Rollup merge of #151004 - apple-sleep-until, r=ChrisDenton
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.
Jonathan Brouwer 3 months ago
parent 30ae14f · parent 2807b75 · commit 7c4121a
0 files changed, 0 insertions, 0 deletions