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

tick() hanging on Windows #397

Closed
jfro opened this issue Jun 25, 2019 · 3 comments
Closed

tick() hanging on Windows #397

jfro opened this issue Jun 25, 2019 · 3 comments

Comments

@jfro
Copy link

jfro commented Jun 25, 2019

Ran into tick() not working properly on Windows. Seems to hang select!{} except an occasional run of the binary would see a tick fire.

Example code used below, works on macOS & Rust playground, on windows it times out a few times & then hangs:

use crossbeam_channel as chan;
use std::time::{Duration, Instant};
fn main() {
    let x = chan::tick(Duration::from_millis(50));
    let mut i = 0;
    while i < 10 {
        chan::select! {
            recv(x) -> msg => { i += 1; println!("{} {:?}", i, msg);  },
            default(Duration::from_millis(10)) => {  println!("timeout");  },
        }
    }
}

This also hangs, no select! used:

use std::time::{Duration, Instant};
use crossbeam_channel::tick;

fn main() {
    let start = Instant::now();
    let ticker = tick(Duration::from_millis(100));

    for _ in 0..5 {
        ticker.recv().unwrap();
        println!("elapsed: {:?}", start.elapsed());
    }
}
@jfro
Copy link
Author

jfro commented Jun 25, 2019

I apologize, left out that I'm using crossbeam-channel 0.3.8.

Looks like this might be fixed in master? Testing the non-select snippet above successfully so far.

@mchesser
Copy link

mchesser commented Jul 3, 2019

Yeah this is this issue: #388

@jfro
Copy link
Author

jfro commented Jul 3, 2019

closing since it's fixed in master, thanks!

@jfro jfro closed this as completed Jul 3, 2019
exrook pushed a commit to exrook/crossbeam that referenced this issue Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants