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.
- public static function newForPath($lockfile) — Create a new lock on a lockfile. The file need not exist yet.
Determining Lock Status
- final public function isLocked() — Determine if the lock is currently held.
Locking
- protected function doLock($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.
- protected function doUnlock() — Release the lock. Throws an exception on failure, e.g. if the lock is not currently held.
- 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.
Other Methods
- public function __get($name)
- public function __set($name, $value)
- public function current()
- public function key()
- public function next()
- public function rewind()
- public function valid()
- private function throwOnAttemptedIteration()
- public function getPhobjectClassConstant($key, $byte_limit) — Read the value of a class constant.