Skip to main content

Module io_timeout

Module io_timeout 

Source

Structs§

TimedOut
The operation did not complete within the given timeout. The spawned worker thread is left to run to completion in the background (there is no safe way to cancel a blocked syscall from the outside); this trades a leaked thread for never hanging the caller.

Enums§

WaitOutcome
Outcome of waiting on a child process with a deadline.

Constants§

DEFAULT_IO_TIMEOUT
Default ceiling for any single blocking file/subprocess operation that touches a path supplied by the caller (e.g. a scanned media file). Chosen to comfortably exceed a slow spinning disk or network share while still surfacing a stale/disconnected mount point (which otherwise blocks the underlying syscall forever on macOS) within one command’s run.

Functions§

run_with_timeout
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.
wait_with_timeout
Polls child for completion, killing it if it hasn’t exited within timeout. Unlike a raw blocking .wait()/.status(), this guarantees the caller gets control back within roughly timeout even if the child itself is stuck on an unresponsive mount point.