laputa-blocking 0.3.0

A thread pool for isolating blocking I/O in async programs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::thread;
use std::time::Duration;

use blocking::unblock;
use futures_lite::future;

#[test]
fn idle_thread_exits() {
    future::block_on(async {
        let first = unblock(|| thread::current().id()).await;
        thread::sleep(Duration::from_millis(800));
        let second = unblock(|| thread::current().id()).await;
        assert_ne!(first, second);
    });
}