mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
std: move locks to sys
on SGX
This commit is contained in:
parent
0cd21cc549
commit
c2d0f8452f
@ -1,5 +1,8 @@
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_os = "solid_asp3")] {
|
||||
if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
|
||||
mod sgx;
|
||||
pub use sgx::Condvar;
|
||||
} else if #[cfg(target_os = "solid_asp3")] {
|
||||
mod itron;
|
||||
pub use itron::Condvar;
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
use crate::sys::locks::Mutex;
|
||||
use crate::sys::pal::waitqueue::{SpinMutex, WaitQueue, WaitVariable};
|
||||
use crate::sys_common::lazy_box::{LazyBox, LazyInit};
|
||||
use crate::time::Duration;
|
||||
|
||||
use super::waitqueue::{SpinMutex, WaitQueue, WaitVariable};
|
||||
|
||||
/// FIXME: `UnsafeList` is not movable.
|
||||
struct AllocatedCondvar(SpinMutex<WaitVariable<()>>);
|
||||
|
@ -1,6 +1,9 @@
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_os = "solid_asp3")] {
|
||||
if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
|
||||
mod sgx;
|
||||
pub use sgx::Mutex;
|
||||
} else if #[cfg(target_os = "solid_asp3")] {
|
||||
mod itron;
|
||||
pub use itron::Mutex;
|
||||
pub use itron::Condvar;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
use super::waitqueue::{try_lock_or_false, SpinMutex, WaitQueue, WaitVariable};
|
||||
use crate::sys::pal::waitqueue::{try_lock_or_false, SpinMutex, WaitQueue, WaitVariable};
|
||||
use crate::sys_common::lazy_box::{LazyBox, LazyInit};
|
||||
|
||||
/// FIXME: `UnsafeList` is not movable.
|
@ -1,5 +1,8 @@
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_os = "solid_asp3")] {
|
||||
if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
|
||||
mod sgx;
|
||||
pub use sgx::RwLock;
|
||||
} else if #[cfg(target_os = "solid_asp3")] {
|
||||
mod solid;
|
||||
pub use solid::RwLock;
|
||||
}
|
||||
|
@ -1,13 +1,12 @@
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use crate::alloc::Layout;
|
||||
use crate::num::NonZero;
|
||||
use crate::sys_common::lazy_box::{LazyBox, LazyInit};
|
||||
|
||||
use super::waitqueue::{
|
||||
use crate::sys::pal::waitqueue::{
|
||||
try_lock_or_false, NotifiedTcs, SpinMutex, SpinMutexGuard, WaitQueue, WaitVariable,
|
||||
};
|
||||
use crate::alloc::Layout;
|
||||
use crate::sys_common::lazy_box::{LazyBox, LazyInit};
|
||||
|
||||
struct AllocatedRwLock {
|
||||
readers: SpinMutex<WaitVariable<Option<NonZero<usize>>>>,
|
@ -9,8 +9,6 @@ use crate::io::ErrorKind;
|
||||
use crate::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
pub mod abi;
|
||||
mod waitqueue;
|
||||
|
||||
pub mod alloc;
|
||||
pub mod args;
|
||||
pub mod env;
|
||||
@ -31,16 +29,7 @@ pub mod thread;
|
||||
pub mod thread_local_key;
|
||||
pub mod thread_parking;
|
||||
pub mod time;
|
||||
|
||||
mod condvar;
|
||||
mod mutex;
|
||||
mod rwlock;
|
||||
|
||||
pub mod locks {
|
||||
pub use super::condvar::*;
|
||||
pub use super::mutex::*;
|
||||
pub use super::rwlock::*;
|
||||
}
|
||||
pub mod waitqueue;
|
||||
|
||||
// SAFETY: must be called only once during runtime initialization.
|
||||
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
|
||||
|
Loading…
Reference in New Issue
Block a user