Skip to main content

run_with_timeout

Function run_with_timeout 

Source
pub fn run_with_timeout<T, F>(timeout: Duration, f: F) -> Result<T, TimedOut>
where F: FnOnce() -> T + Send + 'static, T: Send + 'static,
Expand description

Runs f on a helper thread and waits up to timeout for it to finish. Use this to bound any blocking call (std::fs::*, image::open, a subprocess .wait()) that could otherwise block indefinitely against an unresponsive mount point.