예제 #1
0
 /**
  * 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++;
 }
예제 #2
0
 /**
  * Lock shared memory
  * 
  * @return boolean    True if locked, otherwise false
  */
 public function lock()
 {
     return $this->mutex->acquire();
 }