Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switches wasm-timer for futures-timer. #776

Merged
merged 3 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://book.async.rs/overview

## [Unreleased]

## Changed

- For `wasm`, switched underlying `Timer` implementation to [`futures-timer`](https://github.com/async-rs/futures-timer). ([#776](https://github.com/async-rs/async-std/pull/776))

# [1.6.0-beta.1] - 2020-05-07

## Added
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ std = [
"pin-utils",
"slab",
"smol",
"wasm-timer",
"futures-timer",
"wasm-bindgen-futures",
"futures-channel",
]
Expand Down Expand Up @@ -74,7 +74,7 @@ surf = { version = "1.0.3", optional = true }
smol = { version = "0.1.1", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-timer = { version = "0.2.4", optional = true }
futures-timer = { version = "3.0.2", optional = true, features = ["wasm-bindgen"] }
wasm-bindgen-futures = { version = "0.4.10", optional = true }
futures-channel = { version = "0.3.4", optional = true }

Expand Down
4 changes: 2 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ pub(crate) type Timer = smol::Timer;

#[cfg(all(target_arch = "wasm32", feature = "default"))]
#[derive(Debug)]
pub(crate) struct Timer(wasm_timer::Delay);
pub(crate) struct Timer(futures_timer::Delay);

#[cfg(all(target_arch = "wasm32", feature = "default"))]
impl Timer {
pub(crate) fn after(dur: std::time::Duration) -> Self {
Timer(wasm_timer::Delay::new(dur))
Timer(futures_timer::Delay::new(dur))
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn wait_timeout_with_lock() {

let (m, c) = &*pair;
let (_, wait_result) = c
.wait_timeout(m.lock().await, Duration::from_millis(100))
.wait_timeout(m.lock().await, Duration::from_millis(50))
.await;
assert!(wait_result.timed_out());
})
Expand Down