Skip to content

Commit

Permalink
Fix unsafe operation of wasm32::memory_atomic_notify
Browse files Browse the repository at this point in the history
  • Loading branch information
chansuke committed Oct 24, 2020
1 parent de87ae7 commit d147f78
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/std/src/sys/wasm/condvar_atomics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ impl Condvar {

#[inline]
pub unsafe fn notify_all(&self) {
self.cnt.fetch_add(1, SeqCst);
// SAFETY: memory_atomic_notify()is always valid
unsafe {
self.cnt.fetch_add(1, SeqCst);
wasm32::memory_atomic_notify(self.ptr(), u32::MAX); // -1 == "wake everyone"
}
}
Expand Down

0 comments on commit d147f78

Please sign in to comment.