about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-09-11 04:07:17 +0000
committerbors <bors@rust-lang.org>2022-09-11 04:07:17 +0000
commit56b625be68fef0c78872b3c46be1dfaeb998a04d (patch)
treebab01e6a9fac987fd02cc0ff2aae8b35b6f75d41 /compiler/rustc_codegen_gcc/src
parentabd4d2ef0d23553c1d21b90d3b1353e3a42e1edf (diff)
parent81b11ed6984f4cac4d2d8579dc0f694de024bb5a (diff)
downloadrust-56b625be68fef0c78872b3c46be1dfaeb998a04d.tar.gz
rust-56b625be68fef0c78872b3c46be1dfaeb998a04d.zip
Auto merge of #101482 - joboet:netbsd_parker, r=sanxiyn
Optimize thread parking on NetBSD

As the futex syscall is not present in the latest stable release, NetBSD cannot use the efficient thread parker and locks Linux uses. Currently, it therefore relies on a pthread-based parker, consisting of a mutex and semaphore which protect a state variable. NetBSD however has more efficient syscalls available: [`_lwp_park`](https://man.netbsd.org/_lwp_park.2) and [`_lwp_unpark`](https://man.netbsd.org/_lwp_unpark.2). These already provide the exact semantics of `thread::park` and `Thread::unpark`, but work with thread ids. In `std`, this ID is here stored in an atomic state variable, which is also used to optimize cases were the parking token is already available at the time `thread::park` is called.

r? `@m-ou-se`
Diffstat (limited to 'compiler/rustc_codegen_gcc/src')
0 files changed, 0 insertions, 0 deletions