Skip to main content

Module lock

Module lock 

Source
Expand description

Project-level advisory file lock for setup. Dual-rail: fs2::FileExt::try_lock_exclusive

  • PID/start_time sentinel JSON. Sentinel handles sandbox/NFS/container edge cases where flock alone is unreliable.

Acquire order:

  1. Read .atomcode/.setup.lock.sentinel if present. If recorded PID is alive and its start_time matches, return LockError::Held (unless force = true). Stale sentinel is removed.
  2. try_lock_exclusive on .atomcode/.setup.lock — second rail.
  3. Write a fresh sentinel JSON with current PID, start_time, host, version.

Drop releases both rails (unlock fs2, rm sentinel) but keeps the .setup.lock file so future opens reuse the inode.

Structs§

SetupLock

Enums§

LockError