pub struct WatcherLock { /* private fields */ }Expand description
Proof that this process is the one watcher for this user.
Two watchers are two pollers with two toast budgets, and every toast shown twice; they also count the same activity into one database. The PID file cannot prevent that: it is read and written by whoever starts a watcher, and two starts at the same moment (a scheduled task and a Run key both firing at login) both read “nobody” and both write. An exclusive lock on a file is taken atomically by the OS and let go by the OS when the process dies however it dies, so there is no stale state to clean up.
The lock sits in the data directory, not beside the binary: two copies of kasl installed in two places share one data directory and one lock.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WatcherLock
impl RefUnwindSafe for WatcherLock
impl Send for WatcherLock
impl Sync for WatcherLock
impl Unpin for WatcherLock
impl UnsafeUnpin for WatcherLock
impl UnwindSafe for WatcherLock
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