diff --git a/library/std/src/sys/sync/rwlock/mod.rs b/library/std/src/sys/sync/rwlock/mod.rs index ab5715bf2de33..8603fca2da5b5 100644 --- a/library/std/src/sys/sync/rwlock/mod.rs +++ b/library/std/src/sys/sync/rwlock/mod.rs @@ -19,6 +19,7 @@ cfg_select! { all(target_os = "windows", target_vendor = "win7"), all(target_vendor = "fortanix", target_env = "sgx"), target_os = "xous", + target_os = "teeos", ) => { mod queue; pub use queue::RwLock; @@ -27,10 +28,6 @@ cfg_select! { mod solid; pub use solid::RwLock; } - target_os = "teeos" => { - mod teeos; - pub use teeos::RwLock; - } _ => { mod no_threads; pub use no_threads::RwLock; diff --git a/library/std/src/sys/sync/rwlock/teeos.rs b/library/std/src/sys/sync/rwlock/teeos.rs deleted file mode 100644 index 4a71a3abc2729..0000000000000 --- a/library/std/src/sys/sync/rwlock/teeos.rs +++ /dev/null @@ -1,50 +0,0 @@ -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. -pub struct RwLock { - inner: Mutex, -} - -impl RwLock { - #[inline] - pub const fn new() -> RwLock { - RwLock { inner: Mutex::new() } - } - - #[inline] - pub fn read(&self) { - self.inner.lock() - } - - #[inline] - pub fn try_read(&self) -> bool { - self.inner.try_lock() - } - - #[inline] - pub fn write(&self) { - self.inner.lock() - } - - #[inline] - pub unsafe fn try_write(&self) -> bool { - self.inner.try_lock() - } - - #[inline] - pub unsafe fn read_unlock(&self) { - unsafe { self.inner.unlock() }; - } - - #[inline] - pub unsafe fn write_unlock(&self) { - unsafe { self.inner.unlock() }; - } - - #[inline] - pub unsafe fn downgrade(&self) { - // Since there is no difference between read-locked and write-locked on this platform, this - // function is simply a no-op as only 1 reader can read: the original writer. - } -} diff --git a/library/std/src/sys/sync/thread_parking/mod.rs b/library/std/src/sys/sync/thread_parking/mod.rs index e8a9dc884f816..74b5b72b19a75 100644 --- a/library/std/src/sys/sync/thread_parking/mod.rs +++ b/library/std/src/sys/sync/thread_parking/mod.rs @@ -35,7 +35,10 @@ cfg_select! { mod xous; pub use xous::Parker; } - target_family = "unix" => { + any( + target_family = "unix", + target_os = "teeos", + ) => { mod pthread; pub use pthread::Parker; } diff --git a/src/doc/rustc/src/platform-support/aarch64-unknown-teeos.md b/src/doc/rustc/src/platform-support/aarch64-unknown-teeos.md index be11d0cdd1037..6e7eeb82e4bf4 100644 --- a/src/doc/rustc/src/platform-support/aarch64-unknown-teeos.md +++ b/src/doc/rustc/src/platform-support/aarch64-unknown-teeos.md @@ -5,7 +5,7 @@ Target for the TEEOS operating system. TEEOS is a mini os run in TrustZone, for trusted/security apps. The kernel of TEEOS is HongMeng/ChCore micro kernel. The libc for TEEOS is a part of musl. -It's very small that there is no RwLock, no network, no stdin, and no file system for apps in TEEOS. +It's very small that there is no network, no stdin, and no file system for apps in TEEOS. Some abbreviation: