pub struct PidFile { /* private fields */ }
Expand description
A PID file is a file that contains the PID of a process. It is used to prevent multiple instances of a process from running at the same time, or to provide a lock for a resource which should only be accessed by one process at a time.
Implementations§
Source§impl PidFile
impl PidFile
Sourcepub fn new(path: impl Into<PathBuf>) -> Result<Self, Error>
pub fn new(path: impl Into<PathBuf>) -> Result<Self, Error>
Create a new PID file at the given path for this process.
If the PID file already exists, this function will check if the PID file is still in use. If the PID file is in use, this function will return Err(io::ErrorKind::AddrInUse). If the PID file is not in use, it will be removed and a new PID file will be created.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PidFile
impl RefUnwindSafe for PidFile
impl Send for PidFile
impl Sync for PidFile
impl Unpin for PidFile
impl UnwindSafe for PidFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more