mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 23:12:02 +00:00
Rollup merge of #122386 - joboet:move_pal_once, r=jhpratt
Move `Once` implementations to `sys` Part of https://github.com/rust-lang/rust/issues/117276.
This commit is contained in:
commit
dff680d359
@ -52,7 +52,7 @@ Copyright: 2019 The Crossbeam Project Developers
|
||||
The Rust Project Developers (see https://thanks.rust-lang.org)
|
||||
License: MIT OR Apache-2.0
|
||||
|
||||
Files: library/std/src/sys/locks/mutex/fuchsia.rs
|
||||
Files: library/std/src/sys/sync/mutex/fuchsia.rs
|
||||
Copyright: 2016 The Fuchsia Authors
|
||||
The Rust Project Developers (see https://thanks.rust-lang.org)
|
||||
License: BSD-2-Clause AND (MIT OR Apache-2.0)
|
||||
|
@ -3,7 +3,7 @@ mod tests;
|
||||
|
||||
use crate::fmt;
|
||||
use crate::sync::{mutex, poison, LockResult, MutexGuard, PoisonError};
|
||||
use crate::sys::locks as sys;
|
||||
use crate::sys::sync as sys;
|
||||
use crate::time::{Duration, Instant};
|
||||
|
||||
/// A type indicating whether a timed wait on a condition variable returned
|
||||
|
@ -8,7 +8,7 @@ use crate::mem::ManuallyDrop;
|
||||
use crate::ops::{Deref, DerefMut};
|
||||
use crate::ptr::NonNull;
|
||||
use crate::sync::{poison, LockResult, TryLockError, TryLockResult};
|
||||
use crate::sys::locks as sys;
|
||||
use crate::sys::sync as sys;
|
||||
|
||||
/// A mutual exclusion primitive useful for protecting shared data
|
||||
///
|
||||
|
@ -8,7 +8,7 @@ mod tests;
|
||||
|
||||
use crate::fmt;
|
||||
use crate::panic::{RefUnwindSafe, UnwindSafe};
|
||||
use crate::sys_common::once as sys;
|
||||
use crate::sys::sync as sys;
|
||||
|
||||
/// A synchronization primitive which can be used to run a one-time global
|
||||
/// initialization. Useful for one-time initialization for FFI or related
|
||||
|
@ -6,7 +6,7 @@ use crate::fmt;
|
||||
use crate::ops::Deref;
|
||||
use crate::panic::{RefUnwindSafe, UnwindSafe};
|
||||
use crate::sync::atomic::{AtomicUsize, Ordering::Relaxed};
|
||||
use crate::sys::locks as sys;
|
||||
use crate::sys::sync as sys;
|
||||
|
||||
/// A re-entrant mutual exclusion lock
|
||||
///
|
||||
|
@ -8,7 +8,7 @@ use crate::mem::ManuallyDrop;
|
||||
use crate::ops::{Deref, DerefMut};
|
||||
use crate::ptr::NonNull;
|
||||
use crate::sync::{poison, LockResult, TryLockError, TryLockResult};
|
||||
use crate::sys::locks as sys;
|
||||
use crate::sys::sync as sys;
|
||||
|
||||
/// A reader-writer lock
|
||||
///
|
||||
|
@ -6,9 +6,9 @@ mod pal;
|
||||
mod personality;
|
||||
|
||||
pub mod cmath;
|
||||
pub mod locks;
|
||||
pub mod os_str;
|
||||
pub mod path;
|
||||
pub mod sync;
|
||||
#[allow(dead_code)]
|
||||
#[allow(unused_imports)]
|
||||
pub mod thread_local;
|
||||
|
@ -19,8 +19,6 @@ pub mod fs;
|
||||
#[path = "../unsupported/io.rs"]
|
||||
pub mod io;
|
||||
pub mod net;
|
||||
#[path = "../unsupported/once.rs"]
|
||||
pub mod once;
|
||||
pub mod os;
|
||||
#[path = "../unsupported/pipe.rs"]
|
||||
pub mod pipe;
|
||||
|
@ -21,8 +21,6 @@ pub mod fs;
|
||||
pub mod io;
|
||||
#[path = "../unsupported/net.rs"]
|
||||
pub mod net;
|
||||
#[path = "../unsupported/once.rs"]
|
||||
pub mod once;
|
||||
pub mod os;
|
||||
#[path = "../unsupported/pipe.rs"]
|
||||
pub mod pipe;
|
||||
|
@ -6,7 +6,6 @@ pub mod env;
|
||||
pub mod fs;
|
||||
pub mod io;
|
||||
pub mod net;
|
||||
pub mod once;
|
||||
pub mod os;
|
||||
pub mod pipe;
|
||||
pub mod process;
|
||||
|
@ -41,8 +41,6 @@ pub mod time;
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(not(target_feature = "atomics"))] {
|
||||
#[path = "../unsupported/once.rs"]
|
||||
pub mod once;
|
||||
#[path = "../unsupported/thread_parking.rs"]
|
||||
pub mod thread_parking;
|
||||
}
|
||||
|
@ -51,10 +51,6 @@ cfg_if::cfg_if! {
|
||||
if #[cfg(target_feature = "atomics")] {
|
||||
compile_error!("The wasm32-wasip2 target does not support atomics");
|
||||
} else {
|
||||
#[path = "../unsupported/locks/mod.rs"]
|
||||
pub mod locks;
|
||||
#[path = "../unsupported/once.rs"]
|
||||
pub mod once;
|
||||
#[path = "../unsupported/thread_parking.rs"]
|
||||
pub mod thread_parking;
|
||||
}
|
||||
|
@ -48,8 +48,6 @@ cfg_if::cfg_if! {
|
||||
#[path = "atomics/thread.rs"]
|
||||
pub mod thread;
|
||||
} else {
|
||||
#[path = "../unsupported/once.rs"]
|
||||
pub mod once;
|
||||
#[path = "../unsupported/thread.rs"]
|
||||
pub mod thread;
|
||||
#[path = "../unsupported/thread_parking.rs"]
|
||||
|
@ -21,8 +21,6 @@ pub mod fs;
|
||||
pub mod io;
|
||||
#[path = "../unsupported/net.rs"]
|
||||
pub mod net;
|
||||
#[path = "../unsupported/once.rs"]
|
||||
pub mod once;
|
||||
pub mod os;
|
||||
#[path = "../unsupported/pipe.rs"]
|
||||
pub mod pipe;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::sync::atomic::{AtomicU32, Ordering::Relaxed};
|
||||
use crate::sys::futex::{futex_wait, futex_wake, futex_wake_all};
|
||||
use crate::sys::locks::Mutex;
|
||||
use crate::sys::sync::Mutex;
|
||||
use crate::time::Duration;
|
||||
|
||||
pub struct Condvar {
|
@ -2,7 +2,7 @@
|
||||
use crate::sys::pal::itron::{
|
||||
abi, error::expect_success_aborting, spin::SpinMutex, task, time::with_tmos_strong,
|
||||
};
|
||||
use crate::{mem::replace, ptr::NonNull, sys::locks::Mutex, time::Duration};
|
||||
use crate::{mem::replace, ptr::NonNull, sys::sync::Mutex, time::Duration};
|
||||
|
||||
// The implementation is inspired by the queue-based implementation shown in
|
||||
// Andrew D. Birrell's paper "Implementing Condition Variables with Semaphores"
|
@ -1,4 +1,4 @@
|
||||
use crate::sys::locks::Mutex;
|
||||
use crate::sys::sync::Mutex;
|
||||
use crate::time::Duration;
|
||||
|
||||
pub struct Condvar {}
|
@ -1,7 +1,7 @@
|
||||
use crate::cell::UnsafeCell;
|
||||
use crate::ptr;
|
||||
use crate::sync::atomic::{AtomicPtr, Ordering::Relaxed};
|
||||
use crate::sys::locks::{mutex, Mutex};
|
||||
use crate::sys::sync::{mutex, Mutex};
|
||||
#[cfg(not(target_os = "nto"))]
|
||||
use crate::sys::time::TIMESPEC_MAX;
|
||||
#[cfg(target_os = "nto")]
|
@ -1,5 +1,5 @@
|
||||
use crate::sys::locks::Mutex;
|
||||
use crate::sys::pal::waitqueue::{SpinMutex, WaitQueue, WaitVariable};
|
||||
use crate::sys::sync::Mutex;
|
||||
use crate::sys_common::lazy_box::{LazyBox, LazyInit};
|
||||
use crate::time::Duration;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::cell::UnsafeCell;
|
||||
use crate::ptr;
|
||||
use crate::sync::atomic::{AtomicPtr, Ordering::Relaxed};
|
||||
use crate::sys::locks::mutex::{self, Mutex};
|
||||
use crate::sys::sync::mutex::{self, Mutex};
|
||||
use crate::sys::time::TIMESPEC_MAX;
|
||||
use crate::sys_common::lazy_box::{LazyBox, LazyInit};
|
||||
use crate::time::Duration;
|
@ -1,7 +1,7 @@
|
||||
use crate::cell::UnsafeCell;
|
||||
use crate::sys::c;
|
||||
use crate::sys::locks::{mutex, Mutex};
|
||||
use crate::sys::os;
|
||||
use crate::sys::sync::{mutex, Mutex};
|
||||
use crate::time::Duration;
|
||||
|
||||
pub struct Condvar {
|
@ -1,6 +1,6 @@
|
||||
use crate::os::xous::ffi::{blocking_scalar, scalar};
|
||||
use crate::os::xous::services::{ticktimer_server, TicktimerScalar};
|
||||
use crate::sys::locks::Mutex;
|
||||
use crate::sys::sync::Mutex;
|
||||
use crate::time::Duration;
|
||||
use core::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
@ -1,7 +1,9 @@
|
||||
mod condvar;
|
||||
mod mutex;
|
||||
mod once;
|
||||
mod rwlock;
|
||||
|
||||
pub use condvar::Condvar;
|
||||
pub use mutex::Mutex;
|
||||
pub use once::{Once, OnceState};
|
||||
pub use rwlock::RwLock;
|
@ -30,6 +30,7 @@ cfg_if::cfg_if! {
|
||||
mod queue;
|
||||
pub use queue::{Once, OnceState};
|
||||
} else {
|
||||
pub use crate::sys::once::{Once, OnceState};
|
||||
mod no_threads;
|
||||
pub use no_threads::{Once, OnceState};
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
use crate::sys::locks::mutex::Mutex;
|
||||
use crate::sys::sync::mutex::Mutex;
|
||||
|
||||
/// we do not supported rwlock, so use mutex to simulate rwlock.
|
||||
/// it's useful because so many code in std will use rwlock.
|
@ -24,7 +24,6 @@ pub mod backtrace;
|
||||
pub mod fs;
|
||||
pub mod io;
|
||||
pub mod lazy_box;
|
||||
pub mod once;
|
||||
pub mod process;
|
||||
pub mod thread;
|
||||
pub mod thread_info;
|
||||
|
@ -10,7 +10,7 @@
|
||||
//
|
||||
// cdb-command:dx m,d
|
||||
// cdb-check:m,d [Type: std::sync::mutex::Mutex<i32>]
|
||||
// cdb-check: [...] inner [Type: std::sys::locks::mutex::futex::Mutex]
|
||||
// cdb-check: [...] inner [Type: std::sys::sync::mutex::futex::Mutex]
|
||||
// cdb-check: [...] poison [Type: std::sync::poison::Flag]
|
||||
// cdb-check: [...] data : 0 [Type: core::cell::UnsafeCell<i32>]
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
// cdb-command:dx r
|
||||
// cdb-check:r [Type: std::sync::rwlock::RwLockReadGuard<i32>]
|
||||
// cdb-check: [...] data : NonNull([...]: 0) [Type: core::ptr::non_null::NonNull<i32>]
|
||||
// cdb-check: [...] inner_lock : [...] [Type: std::sys::locks::rwlock::futex::RwLock *]
|
||||
// cdb-check: [...] inner_lock : [...] [Type: std::sys::sync::rwlock::futex::RwLock *]
|
||||
|
||||
#[allow(unused_variables)]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user