/** * CMbSemaphore Constructor * * @param string $key semaphore identifier */ function __construct($key) { $this->path = CAppUI::conf("root_dir") . "/tmp/locks"; CMbPath::forceDir($this->path); $this->process = getmypid(); $prefix = CApp::getAppIdentifier(); $this->key = "{$prefix}-sem-{$key}"; }
/** * Construct * * @param string $key lock identifier */ function __construct($key) { $this->path = CAppUI::conf("root_dir") . "/tmp/locks"; $this->process = getmypid(); $prefix = CApp::getAppIdentifier(); $this->key = "{$prefix}-lock-{$key}"; $this->filename = "{$this->path}/{$this->key}"; CMbPath::forceDir(dirname($this->filename)); }
/** * Get the lock key name * * @return string */ protected function getLockKey() { $prefix = CApp::getAppIdentifier(); return "{$prefix}-mutex-{$this->key}"; }