Expand description
One daemon per config directory.
run holds <config dir>/daemon.lock exclusively for its whole life;
the OS releases it when the process exits, however it exits. The tray UI
uses is_held to tell “no daemon” (start one) from “a daemon is
starting” (wait).
Structs§
- Daemon
Lock - The held daemon lock; dropping it releases the lock.
Enums§
Constants§
- ACQUIRE_
ATTEMPTS - How often
acquiretries before concluding another daemon runs, and the pause between tries. Covers the instant the tray UI’sis_heldprobe holds the lock shared. - ACQUIRE_
PAUSE - LOCK_
FILE_ NAME - The lock file’s name, next to
config.toml. - PID_
FILE_ NAME - Where the daemon writes its pid, next to the lock. Separate from the lock file because Windows locks are mandatory: a locked file cannot be read, even by the process that holds it through another handle.
- WAIT_
POLL - How often a waiting daemon retries the lock. Safe range 0.5..=10 s.
Functions§
- acquire
- Take the daemon lock for the config at
config_path, logging the outcome. - acquire_
with acquirewith an explicit retry budget.- is_held
- Whether a daemon holds the lock for the config at
config_path. - lock_
path_ for - The lock file for the config at
config_path. - pid_
path_ for - The pid file for the config at
config_path. - wait_
until_ acquired - Block until this process holds the daemon lock (
run --wait-for-lock, for a supervised daemon). Logs once when it starts waiting.