Example #1
0
 /**
  * Release the supplied Lockable, or all locks.
  *
  * @param LockableInterface $lockable
  * @return mixed
  */
 public function release(LockableInterface $lockable = NULL)
 {
     if ($lockable == NULL) {
         lock_release_all();
         return;
     }
     lock_release($lockable->getLockName());
 }
 /**
  * @param LockableInterface $lockable
  * @return mixed
  */
 public function release(LockableInterface $lockable = NULL)
 {
     if ($lockable == NULL) {
         $this->locks = array();
         return TRUE;
     }
     unset($this->locks[$lockable->getLockName()]);
     return TRUE;
 }
Example #3
0
 /**
  * Release a lock.
  *
  * @param LockableInterface|NULL $lockable
  *  The lockable to release.  If NULL, release all locks.
  * @return boolean
  *  TRUE if the lockable was released, FALSE otherwise.
  */
 public function release(LockableInterface $lockable = NULL)
 {
     return apc_delete($lockable->getLockName());
 }
Example #4
0
 /**
  * Write a PID to a file.
  *
  * @param $filename
  * @param $pid
  * @return bool
  */
 protected function writeFile(LockableInterface $lockable)
 {
     $bytes = file_put_contents($this->getFileName($lockable->getLockName()), getmypid());
     if (!empty($bytes)) {
         return TRUE;
     }
     return FALSE;
 }