vthread 0.0.1

Bounded carrier-affine virtual threads for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::{
    thread,
    time::{Duration, Instant},
};

pub(crate) fn until(mut condition: impl FnMut() -> bool) {
    let deadline = Instant::now() + Duration::from_secs(5);
    while !condition() {
        assert!(
            Instant::now() < deadline,
            "timed out waiting for test synchronization"
        );
        thread::yield_now();
    }
}