desync 0.9.0

A hassle-free data type for asynchronous programming
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use desync::scheduler::*;

#[test]
#[cfg(not(miri))]   // slow!
fn will_despawn_extra_threads() {
    // As we join with the threads, we'll timeout if any of the spawned threads fail to end
    let scheduler = scheduler();

    // Maximum of 10 threads, but we'll spawn 20
    scheduler.set_max_threads(10);
    for _ in 1..20 {
        scheduler.spawn_thread();
    }

    scheduler.despawn_threads_if_overloaded();
}