/** * Acquires an exclusive lock for this shared memory. * * If the lock is already acquired then only increment counter of lockings. */ private function lock() { if ($this->numberLocks === 0) { $this->semaphore->acquire(); } $this->numberLocks++; }
/** * Lock shared memory * * @return boolean True if locked, otherwise false */ public function lock() { return $this->mutex->acquire(); }