Skip to content

Commit

Permalink
fixup! feat: implement memory.atomic.notify,wait32,wait64
Browse files Browse the repository at this point in the history
Signed-off-by: Harald Hoyer <harald@profian.com>
  • Loading branch information
haraldh committed Nov 17, 2022
1 parent f444188 commit 3bd3fb6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/runtime/src/libcalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ unsafe fn memory_atomic_wait32(
let atomic = unsafe { &*(addr as *const AtomicU32) };

// We want the sequential consistency of `SeqCst` to ensure that the `load` sees the value that the `notify` will/would see.
// All WASM atomic operations are also `SeqCst`.
let validate = || atomic.load(Ordering::SeqCst) == expected;

do_atomic_wait(addr_index, timeout, spot, validate)
Expand All @@ -495,6 +496,7 @@ unsafe fn memory_atomic_wait64(
let atomic = unsafe { &*(addr as *const AtomicU64) };

// We want the sequential consistency of `SeqCst` to ensure that the `load` sees the value that the `notify` will/would see.
// All WASM atomic operations are also `SeqCst`.
let validate = || atomic.load(Ordering::SeqCst) == expected;

do_atomic_wait(addr_index, timeout, spot, validate)
Expand Down

0 comments on commit 3bd3fb6

Please sign in to comment.