about summary refs log tree commit diff
path: root/library/std/src/sys/itron
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/sys/itron')
-rw-r--r--library/std/src/sys/itron/mutex.rs93
1 files changed, 0 insertions, 93 deletions
diff --git a/library/std/src/sys/itron/mutex.rs b/library/std/src/sys/itron/mutex.rs
index e01f595ac54..5ee231882bb 100644
--- a/library/std/src/sys/itron/mutex.rs
+++ b/library/std/src/sys/itron/mutex.rs
@@ -5,7 +5,6 @@ use super::{
     error::{expect_success, expect_success_aborting, fail, ItronError},
     spin::SpinIdOnceCell,
 };
-use crate::cell::UnsafeCell;
 
 pub struct Mutex {
     /// The ID of the underlying mutex object
@@ -89,95 +88,3 @@ impl Drop for MutexGuard<'_> {
         unsafe { self.0.unlock() };
     }
 }
-
-// All empty stubs because this platform does not yet support threads, so lock
-// acquisition always succeeds.
-pub struct ReentrantMutex {
-    /// The ID of the underlying mutex object
-    mtx: abi::ID,
-    /// The lock count.
-    count: UnsafeCell<usize>,
-}
-
-unsafe impl Send for ReentrantMutex {}
-unsafe impl Sync for ReentrantMutex {}
-
-impl ReentrantMutex {
-    pub const unsafe fn uninitialized() -> ReentrantMutex {
-        ReentrantMutex { mtx: 0, count: UnsafeCell::new(0) }
-    }
-
-    pub unsafe fn init(&mut self) {
-        self.mtx = expect_success(
-            unsafe {
-                abi::acre_mtx(&abi::T_CMTX {
-                    // Priority inheritance mutex
-                    mtxatr: abi::TA_INHERIT,
-                    // Unused
-                    ceilpri: 0,
-                })
-            },
-            &"acre_mtx",
-        );
-    }
-
-    pub unsafe fn lock(&self) {
-        match unsafe { abi::loc_mtx(self.mtx) } {
-            abi::E_OBJ => {
-                // Recursive lock
-                unsafe {
-                    let count = &mut *self.count.get();
-                    if let Some(new_count) = count.checked_add(1) {
-                        *count = new_count;
-                    } else {
-                        // counter overflow
-                        rtabort!("lock count overflow");
-                    }
-                }
-            }
-            er => {
-                expect_success(er, &"loc_mtx");
-            }
-        }
-    }
-
-    pub unsafe fn unlock(&self) {
-        unsafe {
-            let count = &mut *self.count.get();
-            if *count > 0 {
-                *count -= 1;
-                return;
-            }
-        }
-
-        expect_success_aborting(unsafe { abi::unl_mtx(self.mtx) }, &"unl_mtx");
-    }
-
-    pub unsafe fn try_lock(&self) -> bool {
-        let er = unsafe { abi::ploc_mtx(self.mtx) };
-        if er == abi::E_OBJ {
-            // Recursive lock
-            unsafe {
-                let count = &mut *self.count.get();
-                if let Some(new_count) = count.checked_add(1) {
-                    *count = new_count;
-                } else {
-                    // counter overflow
-                    rtabort!("lock count overflow");
-                }
-            }
-            true
-        } else if er == abi::E_TMOUT {
-            // Locked by another thread
-            false
-        } else {
-            expect_success(er, &"ploc_mtx");
-            // Top-level lock by the current thread
-            true
-        }
-    }
-
-    pub unsafe fn destroy(&self) {
-        expect_success_aborting(unsafe { abi::del_mtx(self.mtx) }, &"del_mtx");
-    }
-}