Remove unnecessary unsafe block from condvar_atomics & mutex_atomics
This commit is contained in:
parent
d147f78e36
commit
d37b8cf729
@ -53,7 +53,7 @@ impl Condvar {
|
||||
#[inline]
|
||||
pub unsafe fn notify_all(&self) {
|
||||
self.cnt.fetch_add(1, SeqCst);
|
||||
// SAFETY: memory_atomic_notify()is always valid
|
||||
// SAFETY: ptr() is always valid
|
||||
unsafe {
|
||||
wasm32::memory_atomic_notify(self.ptr(), u32::MAX); // -1 == "wake everyone"
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ impl Mutex {
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn try_lock(&self) -> bool {
|
||||
unsafe { self.locked.compare_exchange(0, 1, SeqCst, SeqCst).is_ok() }
|
||||
self.locked.compare_exchange(0, 1, SeqCst, SeqCst).is_ok()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -86,7 +86,7 @@ unsafe impl Sync for ReentrantMutex {}
|
||||
|
||||
impl ReentrantMutex {
|
||||
pub const unsafe fn uninitialized() -> ReentrantMutex {
|
||||
unsafe { ReentrantMutex { owner: AtomicU32::new(0), recursions: UnsafeCell::new(0) } }
|
||||
ReentrantMutex { owner: AtomicU32::new(0), recursions: UnsafeCell::new(0) }
|
||||
}
|
||||
|
||||
pub unsafe fn init(&self) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user