izta 0.1.2

Izta is a drop-in job queue for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::thread::JoinHandle;
use std::time::Duration;

pub fn new_supervised_thread<F, T>(f: F) -> JoinHandle<()>
where
    F: FnOnce() -> T,
    F: Send + 'static + Clone + std::marker::Sync,
    T: Send + 'static,
{
    std::thread::spawn(move || {
        while std::thread::spawn(f.clone()).join().is_err() {
            std::thread::sleep(Duration::from_secs(1))
        }
    })
}