rust/library/std/src/sys
Dylan DPC cbe5e7bc62
Rollup merge of #102773 - joboet:apple_parker, r=thomcc
Use semaphores for thread parking on Apple platforms

Currently we use a mutex-condvar pair for thread parking on Apple systems. Unfortunately, `pthread_cond_timedwait` uses the real-time clock for measuring time, which causes problems when the system time changes. The parking implementation in this PR uses a semaphore instead, which measures monotonic time by default, avoiding these issues. As a further benefit, this has the potential to improve performance a bit, since `unpark` does not need to wait for a lock to be released.

Since the Mach semaphores are poorly documented (I could not find availability or stability guarantees for instance), this uses a [dispatch semaphore](https://developer.apple.com/documentation/dispatch/dispatch_semaphore?language=objc) instead. While it adds a layer of indirection (it uses Mach semaphores internally), the overhead is probably negligible.

Tested on macOS 12.5.

r? ``````@thomcc``````
2022-10-15 15:45:30 +05:30
..
common Reduce CString allocations in std as much as possible 2022-10-03 11:13:17 -07:00
hermit Reduce CString allocations in std as much as possible 2022-10-03 11:13:17 -07:00
itron std: make ReentrantMutex movable and const; simplify Stdout initialization 2022-09-03 14:05:28 +02:00
sgx Bugfix: keep TLS data in sync 2022-10-14 17:07:18 +02:00
solid Auto merge of #102655 - joboet:windows_tls_opt, r=ChrisDenton 2022-10-13 06:49:29 +00:00
unix Rollup merge of #102773 - joboet:apple_parker, r=thomcc 2022-10-15 15:45:30 +05:30
unsupported Add IsTerminal trait to determine if a descriptor or handle is a terminal 2022-10-15 00:35:38 +01:00
wasi Add IsTerminal trait to determine if a descriptor or handle is a terminal 2022-10-15 00:35:38 +01:00
wasm std: use sync::RwLock for internal statics 2022-09-19 23:27:26 +02:00
windows Use Align8 to avoid misalignment if the allocator or Vec doesn't align allocations 2022-10-15 00:35:39 +01:00
mod.rs Reduce CString allocations in std as much as possible 2022-10-03 11:13:17 -07:00