Skip to content

Commit d147f78

Browse files
author
chansuke
committedOct 24, 2020
Fix unsafe operation of wasm32::memory_atomic_notify
1 parent de87ae7 commit d147f78

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎library/std/src/sys/wasm/condvar_atomics.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ impl Condvar {
5252

5353
#[inline]
5454
pub unsafe fn notify_all(&self) {
55+
self.cnt.fetch_add(1, SeqCst);
56+
// SAFETY: memory_atomic_notify()is always valid
5557
unsafe {
56-
self.cnt.fetch_add(1, SeqCst);
5758
wasm32::memory_atomic_notify(self.ptr(), u32::MAX); // -1 == "wake everyone"
5859
}
5960
}

0 commit comments

Comments
 (0)