Lock Implementation
Lock Registry
- final public function getName() — Returns a globally unique name for this lock.
- protected static function getLock($name) — Get a named lock, if it has been registered.
- protected static function registerLock($lock) — Register a lock for cleanup when the process exits.
Constructing Locks
- protected function __construct($name) — Build a new lock, given a lock name. The name should be globally unique across all locks.
Determining Lock Status
- final public function isLocked() — Determine if the lock is currently held.
Locking
- final public function lock($wait) — Acquire the lock. If lock acquisition fails because the lock is held by another process, throws @{class:PhutilLockException}. Other exceptions indicate that lock acquisition has failed for reasons unrelated to locking.
- final public function unlock() — Release the lock. Throws an exception on failure, e.g. if the lock is not currently held.
Internals
- public static function unlockAll() — On shutdown, we release all the locks. You should not call this method directly. Use @{method:unlock} to release individual locks.