Skip to main content

daemon_singleton_holder

Function daemon_singleton_holder 

Source
pub fn daemon_singleton_holder() -> Option<u32>
Expand description

Inspect the daemon singleton state. Returns Some(pid) iff the pidfile names a live wire daemon process — i.e., a singleton is currently held by another in-flight daemon. Returns None if the pidfile is missing, corrupt, or names a dead process.

v0.14.2 (#162): foreground wire daemon (the operator-typed kind, not the ensure_background spawn path) didn’t write its own pidfile, so subsequent ensure_daemon_running() calls couldn’t see it and would spawn duplicates. The duplicate-pull race is safe — per-path outbox locks prevent corruption — but it wastes relay polls and confuses operator diagnosis (“why are there 3 daemons?”). The singleton helpers below let cmd_daemon claim the slot at startup + write its own pidfile, closing the gap.