async-rs / async-rs/futures-timer

`Delay::reset(0)` should cause the delay to poll as Ready immediately

Open
#56 3 comments 0 reactions 1 assignee Claimed by @Lucretiel View on GitHub
Dominant language
Rust
Stars
219
Forks
42
PR merge metrics
No merged PRs in 30d

Description

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 immediately ready. While this makes sense if the 0-duration timer is unconditionally scheduled onto the thread, I found it a bit surprising; could a guarantee be established that this code passes?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.