markAcquire($key); return true; } } return false; } /** * @brief Removes a lock if it was set by us * * @param string $key Name of the lock * * @return mixed */ public function releaseLock($key) { if (empty(self::$semaphore[$key])) { return false; } else { $success = @sem_release(self::$semaphore[$key]); unset(self::$semaphore[$key]); $this->markRelease($key); return $success; } } /** * @brief Checks, if a key is currently locked to a process * * @param string $key The name of the lock * @return bool */ public function isLocked($key) { return @sem_get(self::$semaphore[$key]) !== false; } }