1mod acquisition;
17mod cleanup;
18mod owner;
19mod pid;
20mod stale;
21
22use std::path::PathBuf;
23
24pub use acquisition::{acquire_dir_lock, is_supervising_process, queue_lock_dir};
25pub use owner::{LockOwner, TASK_OWNER_PREFIX, is_task_owner_file, read_lock_owner};
26pub use pid::{PidLiveness, pid_is_running, pid_liveness};
27pub(crate) use stale::{LockStaleness, classify_lock_owner};
28
29#[derive(Debug)]
31pub struct DirLock {
32 lock_dir: PathBuf,
33 owner_path: PathBuf,
34}
35
36impl Drop for DirLock {
37 fn drop(&mut self) {
38 if let Err(error) = cleanup::cleanup_lock_dir(&self.lock_dir, &self.owner_path, false) {
39 log::warn!("Failed to clean up lock directory after retries: {}", error);
40 }
41 }
42}
43
44#[cfg(test)]
45mod tests;