diff options
| author | joboet <jonasboettiger@icloud.com> | 2024-10-01 14:57:38 +0200 |
|---|---|---|
| committer | joboet <jonasboettiger@icloud.com> | 2024-10-01 22:05:35 +0200 |
| commit | c1acccdf1744561d4dda9b943fa91d873cea3b40 (patch) | |
| tree | 58a5bfa4ba8d6644632941fcbffd3b09947be91c /library/std/src/sys/sync/condvar/mod.rs | |
| parent | 21aa500bb050a6aca30d80b1eeb0cb4e1974d57d (diff) | |
| download | rust-c1acccdf1744561d4dda9b943fa91d873cea3b40.tar.gz rust-c1acccdf1744561d4dda9b943fa91d873cea3b40.zip | |
std: replace `LazyBox` with `OnceBox`
This PR replaces the `LazyBox` wrapper used to allocate the pthread primitives with `OnceBox`, which has a more familiar API mirroring that of `OnceLock`. This cleans up the code in preparation for larger changes like #128184 (from which this PR was split) and allows some neat optimizations, like avoid an acquire-load of the allocation pointer in `Mutex::unlock`, where the initialization of the allocation must have already been observed. Additionally, I've gotten rid of the TEEOS `Condvar` code, it's just a duplicate of the pthread one anyway and I didn't want to repeat myself.
Diffstat (limited to 'library/std/src/sys/sync/condvar/mod.rs')
| -rw-r--r-- | library/std/src/sys/sync/condvar/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/library/std/src/sys/sync/condvar/mod.rs b/library/std/src/sys/sync/condvar/mod.rs index 6849cacf88e..d0c998a5597 100644 --- a/library/std/src/sys/sync/condvar/mod.rs +++ b/library/std/src/sys/sync/condvar/mod.rs @@ -12,7 +12,10 @@ cfg_if::cfg_if! { ))] { mod futex; pub use futex::Condvar; - } else if #[cfg(target_family = "unix")] { + } else if #[cfg(any( + target_family = "unix", + target_os = "teeos", + ))] { mod pthread; pub use pthread::Condvar; } else if #[cfg(all(target_os = "windows", target_vendor = "win7"))] { @@ -24,9 +27,6 @@ cfg_if::cfg_if! { } else if #[cfg(target_os = "solid_asp3")] { mod itron; pub use itron::Condvar; - } else if #[cfg(target_os = "teeos")] { - mod teeos; - pub use teeos::Condvar; } else if #[cfg(target_os = "xous")] { mod xous; pub use xous::Condvar; |
