63 if (!GeneralUtility::mkdir($path)) {
67 if (!is_writable($path)) {
70 $this->filePath = $path .
'sem_' . md5((
string)$subject);
71 touch($this->filePath);
72 $this->
id = ftok($this->filePath,
'A');
73 if ($this->
id ===
false) {
74 throw new LockCreateException(
'Cannot create key for semaphore using path ' . $this->filePath, 1396278734);
102 return (
bool)@sem_release($this->resource);
120 if (function_exists(
'sem_get')) {
133 public function acquire($mode = self::LOCK_CAPABILITY_EXCLUSIVE)
139 $this->resource = sem_get($this->
id, 1);
140 if ($this->resource ===
false) {
141 throw new LockAcquireException(
'Unable to get semaphore with id ' . $this->
id, 1313828196);
144 $this->
isAcquired = (bool)sem_acquire($this->resource);
161 if ($this->resource) {
162 sem_remove($this->resource);
163 @unlink($this->filePath);