-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Tokio 0.3 timer will hang when duration is small #3069
Comments
I changed it to the following: fn main() {
let rt = tokio::runtime::Runtime::new().unwrap();
let j = rt.spawn(async move {
let mut i = 0;
loop {
println!("start {}", i);
tokio::time::sleep(std::time::Duration::from_millis(0)).await;
println!("end {}", i);
i += 1;
}
});
rt.block_on(j).unwrap();
} It behaves as I would expect, i.e. printing start and end forever. What do you see? |
@bdonlan is working on timer improvements. He will include this as a test case. The PR should be up soon. |
bdonlan
pushed a commit
to bdonlan/tokio
that referenced
this issue
Oct 30, 2020
This is more-or-less a half-rewrite of the current time driver, supporting the use of intrusive futures for timer registration. Fixes: tokio-rs#3028, tokio-rs#3069
carllerche
pushed a commit
that referenced
this issue
Nov 23, 2020
I think this has been fixed. |
This was referenced Mar 10, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
Platform
and windows 10.
Description
code https://gist.github.com/quininer/72dd236419c67f99b1f9ae0711ca0411
This code may hang on sleep.
I discovered this problem earlier, but I haven't had time to debug it recently. :(
The text was updated successfully, but these errors were encountered: