rust/library/std/src/sys_common
Matthias Krüger ae8794ce6a
Rollup merge of #98391 - joboet:sgx_parker, r=m-ou-se
Reimplement std's thread parker on top of events on SGX

Mutex and Condvar are being replaced by more efficient implementations, which need thread parking themselves (see #93740). Therefore, the generic `Parker` needs to be replaced on all platforms where the new lock implementation will be used.

SGX enclaves have a per-thread event state, which allows waiting for and setting specific bits. This is already used by the current mutex implementation. The thread parker can however be much more efficient, as it only needs to store the `TCS` address of one thread. This address is stored in a state variable, which can also be set to indicate the thread was already notified.

`park_timeout` does not guard against spurious wakeups like the current condition variable does. This is allowed by the API of `Parker`, and I think it is better to let users handle these wakeups themselves as the guarding is quite expensive and might not be necessary.

`@jethrogb` as you wrote the initial SGX support for `std`, I assume you are the target maintainer? Could you help me test this, please? Lacking a x86_64 chip, I can't run SGX.
2022-12-10 09:24:40 +01:00
..
memchr Move std::memchr to sys_common 2021-05-14 03:54:46 +02:00
net Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
once mark sys_common::once::generic::Once::new const-stable 2022-10-18 14:11:02 +00:00
remutex std: make ReentrantMutex movable and const; simplify Stdout initialization 2022-09-03 14:05:28 +02:00
thread_local_key avoid some int2ptr casts in thread_local_key tests 2022-08-11 09:39:25 -04:00
thread_parker Rollup merge of #98391 - joboet:sgx_parker, r=m-ou-se 2022-12-10 09:24:40 +01:00
wtf8 Remove is_known_utf8 checks from more tests where it's no longer set. 2022-06-23 13:10:47 -07:00
backtrace.rs std: use sync::Mutex for internal statics 2022-10-13 12:55:14 +02:00
fs.rs Hide Repr details from io::Error, and rework io::Error::new_const. 2022-02-04 18:47:29 -08:00
io.rs Avoid double panics when using TempDir in tests 2022-01-25 10:36:10 +00:00
lazy_box.rs Leak pthreax_mutex_t when it's dropped while locked. 2022-06-16 12:09:12 +02:00
memchr.rs Move std::memchr to sys_common 2021-05-14 03:54:46 +02:00
mod.rs Auto merge of #104160 - Ayush1325:windows-args, r=m-ou-se 2022-12-01 01:22:32 +00:00
net.rs Reduce CString allocations in std as much as possible 2022-10-03 11:13:17 -07:00
process.rs Remove CommandEnv::apply 2021-12-29 10:07:44 +01:00
remutex.rs std: remove lock wrappers in sys_common 2022-11-06 15:32:59 +01:00
tests.rs std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
thread.rs Relax memory ordering used in min_stack 2022-05-01 15:55:54 -07:00
thread_info.rs Merge two THREAD_INFO.with and following RefCell borrow 2021-09-16 15:24:53 +02:00
thread_local_dtor.rs Remove "sys isn't exported yet" phrase 2022-05-30 12:07:43 +02:00
thread_local_key.rs std: optimize TLS on Windows 2022-10-08 20:19:21 +02:00
wstr.rs Extract WStrUnits to sys_common::wstr 2022-11-28 21:17:08 +05:30
wtf8.rs Auto merge of #96869 - sunfishcode:main, r=joshtriplett 2022-08-24 01:17:52 +00:00