Skip to content

Commit

Permalink
Support wasm64
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jul 27, 2022
1 parent 38a76dc commit ab4362f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -22,5 +22,5 @@ async-channel = "1.5.0"
fastrand = "1.4.0"
futures-lite = "1.11.0"

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
[target.'cfg(any(target_arch = "wasm32", target_arch = "wasm64"))'.dev-dependencies]
wasm-bindgen-test = "0.3"
6 changes: 3 additions & 3 deletions src/mutex.rs
Expand Up @@ -6,7 +6,7 @@ use std::process;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;

#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
use std::time::{Duration, Instant};

use std::usize;
Expand Down Expand Up @@ -114,7 +114,7 @@ impl<T: ?Sized> Mutex<T> {
#[cold]
async fn acquire_slow(&self) {
// Get the current time.
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
let start = Instant::now();

loop {
Expand Down Expand Up @@ -163,7 +163,7 @@ impl<T: ?Sized> Mutex<T> {

// If waiting for too long, fall back to a fairer locking strategy that will prevent
// newer lock operations from starving us forever.
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
if start.elapsed() > Duration::from_micros(500) {
break;
}
Expand Down

0 comments on commit ab4362f

Please sign in to comment.