Skip to content

Commit b327795

Browse files
Merge pull request #776 from azriel91/bugfix/775/wasm-timer-delay
2 parents e20b0f0 + baead51 commit b327795

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://book.async.rs/overview
77

88
## [Unreleased]
99

10+
## Changed
11+
12+
- 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))
13+
1014
# [1.6.0-beta.1] - 2020-05-07
1115

1216
## Added

Diff for: Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ std = [
4343
"pin-utils",
4444
"slab",
4545
"smol",
46-
"wasm-timer",
46+
"futures-timer",
4747
"wasm-bindgen-futures",
4848
"futures-channel",
4949
]
@@ -74,7 +74,7 @@ surf = { version = "1.0.3", optional = true }
7474
smol = { version = "0.1.1", optional = true }
7575

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

Diff for: src/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ pub(crate) type Timer = smol::Timer;
6464

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

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

Diff for: tests/condvar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn wait_timeout_with_lock() {
2929

3030
let (m, c) = &*pair;
3131
let (_, wait_result) = c
32-
.wait_timeout(m.lock().await, Duration::from_millis(100))
32+
.wait_timeout(m.lock().await, Duration::from_millis(50))
3333
.await;
3434
assert!(wait_result.timed_out());
3535
})

0 commit comments

Comments
 (0)