Documentation
¶
Overview ¶
Package datalock is the one-maild-per-data-directory lock: an exclusive flock on <data dir>/maild.lock, held for the life of the process or until released. maild takes it before it opens the database, and mailctl takes it, only to release it, to learn that a stopped maild has let go of it (docs/adr/0046-the-desktop-flatpak-carries-its-own-maild.md). It is a no-op on Windows, whose single instance is the named pipe (ADR-0038).
Index ¶
Constants ¶
const FileName = "maild.lock"
FileName is the lock file in the data directory.
Variables ¶
This section is empty.
Functions ¶
func Acquire ¶
Acquire takes an exclusive lock on dir/maild.lock without waiting, and returns the function that releases it; the lock also ends with the process, even by a crash. dir must exist. A lock another process holds is a *BusyError. A second maild on the same data directory fails here at once, as the socket's "already listening" check cannot stop one that uses another socket, such as one in another Flatpak sandbox.