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))
}
})
}