예제 #1
0
 public function testOpenWhenFileOpened()
 {
     $filepath = '/tmp/LockFile/test.lock';
     $this->assertEquals(false, file_exists($filepath));
     touch($filepath);
     $lockFile = new LockFile($filepath);
     $lockFile->lock(LOCK_EX);
     $target = new LockFile($filepath);
     $this->assertEquals(true, $target->getFileInfo()->isFile());
 }
예제 #2
0
파일: Mutex.php 프로젝트: h4kuna/mutex
 /**
  * Unlock file for another thread.
  * 
  * @return bool
  */
 public function unlock()
 {
     $out = $this->file->lock(LOCK_UN);
     $this->lock = !$out;
     return $out;
 }