mod acquisition;
mod cleanup;
mod owner;
mod pid;
mod stale;
use std::path::PathBuf;
pub use acquisition::{acquire_dir_lock, is_supervising_process, queue_lock_dir};
pub use owner::{LockOwner, TASK_OWNER_PREFIX, is_task_owner_file, read_lock_owner};
pub use pid::{PidLiveness, pid_is_running, pid_liveness};
#[derive(Debug)]
pub struct DirLock {
lock_dir: PathBuf,
owner_path: PathBuf,
}
impl Drop for DirLock {
fn drop(&mut self) {
if let Err(error) = cleanup::cleanup_lock_dir(&self.lock_dir, &self.owner_path, false) {
log::warn!("Failed to clean up lock directory after retries: {}", error);
}
}
}
#[cfg(test)]
mod tests;