maple.utils.lock
Daemon locking utilities.
This module provides Unix socket-based locking to ensure only one instance of the MAPLE daemon runs at a time. It uses filesystem Unix domain sockets as a locking mechanism, which automatically releases when a process terminates.
Key features: - Single daemon instance enforcement - Automatic stale lock detection and cleanup - Context manager support for RAII pattern - Socket liveness checking - Runtime directory support (XDG_RUNTIME_DIR)
The DaemonLock class uses bind() semantics on Unix sockets - only one process can bind to a socket path at a time. This provides a reliable, OS-level locking mechanism that automatically releases if the daemon crashes.
Classes
|
Unix socket-based lock for ensuring single daemon instance. |
Functions
Get the default daemon socket path. |
|
|
Check if the MAPLE daemon is currently running. |