Lock
Mutual exclusion enforcement
Mechanism
A synchronization primitive that enforces exclusive access to a resource. At most one holder may access the protected resource at any time. The holder must explicitly release the lock to allow others to acquire it.
Invariants
- Exclusivity: At most one holder at any time.
- Acquire-before-access: Protected resource cannot be touched without holding the lock.
- Release-after-use: Holder must release after completing the critical section.
Preconditions
- Shared resource exists
- Contending parties can communicate
Postconditions
- Exactly one party holds exclusive access
- Other contenders are blocked or queued
Failure modes
- Deadlock: Holder crashes or hangs without releasing, blocking all other contenders indefinitely.
- Priority Inversion: High-priority contender blocked by low-priority holder.
Caution
Exclusive access — starvation enables denial of service.
Where this came from
—
Used by
- EbbFlowSync references
- Mutex references
- StateLock references
- WorkerMode references
Identity
- Ref:
Lock#95c2 - Hash: sema:Lock#mh:SHA-256:95c2ee952a5301d4b346a5e8693350829d88b3c600048eedcf87bb00c23ee5fb
- Library: bootstrap 0.11.0, root a6a3d1ff0f98
- License: Not stated; check the repository