diff options
| author | wooden-worm <93303706+wooden-worm@users.noreply.github.com> | 2024-06-23 22:58:30 -0700 |
|---|---|---|
| committer | wooden-worm <93303706+wooden-worm@users.noreply.github.com> | 2024-06-23 22:58:30 -0700 |
| commit | 82c5cdc6b1de77634d63faacd6b606c99e816316 (patch) | |
| tree | b55b848d9df33766cab0ebbdb4ff168d164c9338 /library/std/src/sys/pal/wasm/atomics/thread.rs | |
| parent | 25c9f2ca06d6d8d5f314362ffd17e71a8df55546 (diff) | |
| download | rust-82c5cdc6b1de77634d63faacd6b606c99e816316.tar.gz rust-82c5cdc6b1de77634d63faacd6b606c99e816316.zip | |
wasm64 build with target-feature=+simd128,+atomics
Diffstat (limited to 'library/std/src/sys/pal/wasm/atomics/thread.rs')
| -rw-r--r-- | library/std/src/sys/pal/wasm/atomics/thread.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/library/std/src/sys/pal/wasm/atomics/thread.rs b/library/std/src/sys/pal/wasm/atomics/thread.rs index 484bd08495e..afdb159fe6f 100644 --- a/library/std/src/sys/pal/wasm/atomics/thread.rs +++ b/library/std/src/sys/pal/wasm/atomics/thread.rs @@ -19,7 +19,11 @@ impl Thread { pub fn set_name(_name: &CStr) {} pub fn sleep(dur: Duration) { - use crate::arch::wasm32; + #[cfg(target_arch = "wasm32")] + use core::arch::wasm32 as wasm; + #[cfg(target_arch = "wasm64")] + use core::arch::wasm64 as wasm; + use crate::cmp; // Use an atomic wait to block the current thread artificially with a @@ -31,7 +35,7 @@ impl Thread { while nanos > 0 { let amt = cmp::min(i64::MAX as u128, nanos); let mut x = 0; - let val = unsafe { wasm32::memory_atomic_wait32(&mut x, 0, amt as i64) }; + let val = unsafe { wasm::memory_atomic_wait32(&mut x, 0, amt as i64) }; debug_assert_eq!(val, 2); nanos -= amt; } |
