diff options
| author | joboet <jonasboettiger@icloud.com> | 2022-10-18 13:23:49 +0200 |
|---|---|---|
| committer | joboet <jonasboettiger@icloud.com> | 2022-11-06 15:32:59 +0100 |
| commit | 98815742cf2e914ee0d7142a02322cf939c47834 (patch) | |
| tree | 1915c9196da26046e81dddcd90950d1d9c39913c /library/std/src/sys/unix/locks/futex_mutex.rs | |
| parent | 534ddc6166a9031b0c269544929d68f2539ea7a0 (diff) | |
| download | rust-98815742cf2e914ee0d7142a02322cf939c47834.tar.gz rust-98815742cf2e914ee0d7142a02322cf939c47834.zip | |
std: remove lock wrappers in `sys_common`
Diffstat (limited to 'library/std/src/sys/unix/locks/futex_mutex.rs')
| -rw-r--r-- | library/std/src/sys/unix/locks/futex_mutex.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/library/std/src/sys/unix/locks/futex_mutex.rs b/library/std/src/sys/unix/locks/futex_mutex.rs index 33b13dad4d6..c01229586c3 100644 --- a/library/std/src/sys/unix/locks/futex_mutex.rs +++ b/library/std/src/sys/unix/locks/futex_mutex.rs @@ -4,8 +4,6 @@ use crate::sync::atomic::{ }; use crate::sys::futex::{futex_wait, futex_wake}; -pub type MovableMutex = Mutex; - pub struct Mutex { /// 0: unlocked /// 1: locked, no other threads waiting @@ -20,12 +18,12 @@ impl Mutex { } #[inline] - pub unsafe fn try_lock(&self) -> bool { + pub fn try_lock(&self) -> bool { self.futex.compare_exchange(0, 1, Acquire, Relaxed).is_ok() } #[inline] - pub unsafe fn lock(&self) { + pub fn lock(&self) { if self.futex.compare_exchange(0, 1, Acquire, Relaxed).is_err() { self.lock_contended(); } |
