Skip to main content

Module lock

Module lock 

Source
Expand description

Cooperative file locking for workload edits.

The contract from SRD-64 §6.5: every workload-mutating command holds an exclusive lock on the workload file for the duration of read → mutate → write. Concurrent invocations either wait on the lock (up to a 5-second deadline) or error with the holder’s pid (where the OS reports it).

The lock is advisory — it protects concurrent nmbrs invocations, not arbitrary editors. An editor with the workload buffered does not honour this lock; that’s the user’s responsibility, same as any cooperative-locking convention.

Structs§

WorkloadLock
Acquired exclusive lock on a workload file. Drops the lock when the handle is dropped (fs4::FileExt’s contract). Hold this for the duration of one mutate-and-write cycle.

Constants§

LOCK_DEADLINE
Cooperative-lock deadline. SRD-64 §6.5 specifies 5 seconds; held here as a constant so the timeout is inspectable and tunable without diff churn.

Functions§

acquire