Skip to main content

Module lock

Module lock 

Source
Expand description

Locks (spec/sync/README.md §7): advisory O_EXCL lock files under .omgbase/ holding {"pid": <holder>, "ts": <ms>}; a lock whose holder is dead (or whose body is unparsable — §9) is stolen. The writer lock polls; the watch lease is try-only.

Structs§

WatchLease
The watch lease (watch.lock): held by a live watcher for its lifetime.
WriterLock
The workspace writer lock (writer.lock), released on drop.
WriterLockOptions
How long a writer waits, and how often it polls.

Constants§

WATCH_LEASE
watch.lock.
WRITER_LOCK
writer.lock.

Functions§

pid_alive
Whether pid is alive: kill(pid, 0) succeeds, or fails with EPERM (alive but not ours).
read_holder_pid
The holder pid recorded in a lock file, or None when the file is missing, unreadable or not {"pid": n}.
with_writer_lock
Run f holding the writer lock; released even when f fails.