opentally-server/src/common.rs

14 lines
346 B
Rust
Raw Normal View History

use std::thread;
pub trait Waitable: Sized {
fn get_joinhandle(self) -> Option<thread::JoinHandle<()>>;
fn wait(self) {
if let Some(handle) = self.get_joinhandle() {
handle.join().expect("Couldn't join on thread!");
} else {
log::warn!("Tried to wait on non-existent thread!");
}
}
}