futures-timer
futures-timer copied to clipboard
Heap-based async timers
This project looks pretty inactive, but it is still used very widely by the ecosystem and Miri detects UB in it that looks unambiguously bad to me, so that's why...
Just found out there's a wasm-bindgen feature via the PR then reading the Cargo.toml. Would be nice to have this in the README.
The Delay reset method takes a `dur: Duration` parameter but the docs say "Resets this timeout to an new timeout which will fire at the time specified by `at`". The...
Requesting an associated init for `Delay` that sets it with an `Instant` instead of a `Duration` (and completes instantly if the `Instant` is in the past)
consider adding a new struct `Ticker`, which implement `futures::Stream`, can return an instant periodically by use `.next().await`
Rather than having a feature to enable to work on wasm, and then erroring out on wasm targets if that feature isn't enabled, please consider making those dependencies target-specific instead...
Currently, the following pesudocode: ```rust let delay = Delay::new(Duration::from_secs(10)); thread::sleep(5); delay.reset(Duration::from_secs(0)); assert_eq!(delay.poll_unpin(...), Poll::Ready(())); ``` Will spuriously fail on line 4, because resetting the `Delay` to 0 doesn't guarantee that it's...
i.e. like the [Node.js algorithm](https://github.com/nodejs/node/blob/master/lib/internal/timers.js). That is, store the timers in lists mapped to duration then backed by a (much smaller) heap. Using this method guarantees timers are implicitly sorted...
The use of 'heap' for labelling the data structure clashes with dynamic memory 'heap'. This is purely a naming convention change, and should have no affect on implementation.
I'm not familiar enough with this projects finer details and intent behind `src/native/heap.rs`, so my assumptions may be a bit off. I have, however, recently been doing some work that...