diff options
| author | bors <bors@rust-lang.org> | 2022-04-28 21:58:08 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-04-28 21:58:08 +0000 |
| commit | baaa3b682986879c7784b5733ecea942e9ae7de3 (patch) | |
| tree | c044cb80f3dbe8cbc0ce7e767676dd26f6737ccb /src/test | |
| parent | e85edd9a844b523a02dbd89f3c02cd13e4c9fe46 (diff) | |
| parent | 1285fb746649dbad417733a4741cb98e88a497f3 (diff) | |
| download | rust-baaa3b682986879c7784b5733ecea942e9ae7de3.tar.gz rust-baaa3b682986879c7784b5733ecea942e9ae7de3.zip | |
Auto merge of #96393 - joboet:pthread_parker, r=thomcc
std: directly use pthread in UNIX parker implementation `Mutex` and `Condvar` are being replaced by more efficient implementations, which need thread parking themselves (see #93740). Therefore we should use the `pthread` synchronization primitives directly. Also, we can avoid allocating the mutex and condition variable because the `Parker` struct is being placed in an `Arc` anyways. This basically is just a copy of the current `Mutex` and `Condvar` code, which will however be removed (again, see #93740). An alternative implementation could be to use dedicated private `OsMutex` and `OsCondvar` types, but all the other platforms supported by std actually have their own thread parking primitives. I used `Pin` to guarantee a stable address for the `Parker` struct, while the current implementation does not, rather using extra unsafe declaration. Since the thread struct is shared anyways, I assumed this would not add too much clutter while being clearer.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/debuginfo/thread.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/debuginfo/thread.rs b/src/test/debuginfo/thread.rs index 531c37a3421..388d50c5cdc 100644 --- a/src/test/debuginfo/thread.rs +++ b/src/test/debuginfo/thread.rs @@ -14,7 +14,7 @@ // // cdb-command:dx t,d // cdb-check:t,d : [...] [Type: std::thread::Thread *] -// cdb-check: [...] inner : {...} [Type: alloc::sync::Arc<std::thread::Inner>] +// cdb-check:[...] inner [...][Type: core::pin::Pin<alloc::sync::Arc<std::thread::Inner> >] use std::thread; |
