about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js/source-script.js
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-10-15 15:45:30 +0530
committerGitHub <noreply@github.com>2022-10-15 15:45:30 +0530
commitcbe5e7bc623f498426fe27f717a035fcbaebee20 (patch)
tree4dec736abd78a4fd2d137bbe5da0ec5393623931 /src/librustdoc/html/static/js/source-script.js
parent46244f335b5262ef9bdc34cc564b4dea221948f6 (diff)
parentc320ab98ff1d4adb32cece206aa895e4effae175 (diff)
downloadrust-cbe5e7bc623f498426fe27f717a035fcbaebee20.tar.gz
rust-cbe5e7bc623f498426fe27f717a035fcbaebee20.zip
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``````
Diffstat (limited to 'src/librustdoc/html/static/js/source-script.js')
0 files changed, 0 insertions, 0 deletions