Пример #1
0
 /**
  * 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}";
 }
Пример #2
0
 /**
  * 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}";
 }