Skip to content

Commit

Permalink
Remove unnecessary unsafe block from condvar_atomics & mutex_atomics
Browse files Browse the repository at this point in the history
  • Loading branch information
chansuke committed Oct 24, 2020
1 parent d147f78 commit d37b8cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion library/std/src/sys/wasm/condvar_atomics.rs
Expand Up @@ -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"
}
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/wasm/mutex_atomics.rs
Expand Up @@ -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]
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit d37b8cf

Please sign in to comment.