Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 377 Bytes

README.md

File metadata and controls

18 lines (14 loc) · 377 Bytes

toy-rumtime

Demonstrates rust async runtime, just show how Future Waker vtable work.

fn main() {
    let toy = Toy::new();

    for i in 1..=20 {
        toy.spawn(async move {
            let ret = FakeIO::new(Duration::from_secs(i)).await;
            println!("{:?}: {:?}", thread::current().id(), ret);
        })
    }

    toy.run(4); // 4 threads
}