/** * Will release a lock with the given name, * if it has been acquired before */ public function release() { if ($this->counter > 1) { // this is a lock that we acquired multiple times: // simply decrease counter $this->counter -= 1; //error_log('released ' . getmypid() . "[{$this->counter}]"); } elseif ($this->counter == 1) { // simply release the lock $this->counter = 0; $this->lock->release(); self::$_acquired_lock = NULL; //error_log('released ' . getmypid()); } else { // lock has already been released! error_log("org.project60.sepa: This process cannot realease lock '{$name}', it has already been released before."); throw new Exception("This process cannot realease lock '{$name}', it has already been released before."); } }