Invoked before the mutex is unlocked.
The default implementation raises the onBeforeUnlock event
@return boolean true if the unlock should continue
541080
public function beforeUnlock () {
        $event = new ModelEvent;
        $event->sender = $this;
        $this->onBeforeUnlock ($event);
        return $event->isValid;
    }
430881
public function unlock()
    {
        $this->storage->openWriter();
        $object = $this->getObjectSafely('openWriter');
        $object->setLocked(false);
        $this->lock = false;
        $this->storage->setObject($object);
        $this->storage->close();
        return $this;
    }
258955
public function obtainLock()
    {
        $tries       = 0;
        $waitClosure = $this->getWaitClosure();
        do {
            if ($this->doLock()->isLocked()) {
                return $this;
            }

            ++$tries;
            $waitClosure();
        } while ($tries < $this->lockTry);

        return $this;
    }
1365846
public function isLocked() {
		$options = get_option( 'pressbooks_export_options' );
		if ( realpath( $this->getLockDir( false ) . '/lock.json' ) && isset( $options['theme_lock'] ) && 1 === absint( $options['theme_lock'] ) ) {
			return true;
		}
		return false;
	}
919345
public function remove()
    {
        if ($this->locked) {
            throw new \RuntimeException('can not remove a locked semaphore resource');
        }
        if (!is_resource($this->lock_id)) {
            throw new \RuntimeException('can not remove a empty semaphore resource');
        }

        if (!sem_release($this->lock_id)) {
            return false;
        }

        return true;
    }
142419
public function isUnlocked()
    {
        if (!is_null($this->unlockedAt)) {
            return true;
        }
        if ($this->points >= $this->details->points) {
            return true;
        }
        return false;
    }
72007
public function unlock()
    {
        $userid = $this->getObject('user')->getId();

        //Only an saved row can be unlocked by the user who locked it
        if(!$this->isNew() && $this->locked_by != 0 && $this->locked_by == $userid)
        {
            $this->locked_by = 0;
            $this->locked_on = 0;

            $this->save();
        }

        return true;
    }
456782
public function unlock()
    {
        $this->count--;

        if ($this->count < 0) {
            $this->count = 0;
            return false;
        }

        if (0 === $this->count) {
            $this->entityManager->flush();

            return true;
        }

        return false;
    }
58436
public boolean hasCorrectLockstate() {

        org.opencms.lock.CmsLock lock = null;
        try {
            // get the lock state for the current resource
            lock = getCms().getLock(getParamResource());
        } catch (CmsException e) {
            // error getting lock state, log the error and return false
            LOG.error(e.getLocalizedMessage(getLocale()), e);
            return false;
        }
        // check if auto lock feature is enabled
        boolean autoLockFeature = lock.isNullLock() && OpenCms.getWorkplaceManager().autoLockResources();
        return autoLockFeature || lock.isExclusive() || lock.isInherited();
    }
453128
final public function lock()
    {
        if (!isset($this->name) || empty($this->name) || ($this->name === 'default')) {
            //@TODO throw exception, namespace cannot be locked;
            return false;
        }
        //echo $this->name." is ".$locked;
        $this->lock = TRUE;
    }
252244
public synchronized void unlockExclusive()
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "unlockExclusive", this);

    // Synchronize on the locking Mutex.
    synchronized (iMutex)
    {
      // Only release the lock if the holder is the current thread.
      if (Thread.currentThread() == iExclusiveLockHolder)
      {
        if (tc.isDebugEnabled())
          SibTr.debug(tc, "Unlocking current thread " + (iExclusiveLockCount - 1));

        // Decrement the exclusive lock count,
        // if the count reaches 0 then we know that 
        // we can safely remove the exclusive lock
        if (--iExclusiveLockCount == 0)
        {
          // Set the flag to indicate that the exclusive lock
          // has been released.
          iExclusivelyLocked = false;

          // Set the exclusive lock holder thread to be null
          iExclusiveLockHolder = null;

          // Notify any threads waiting for this lock.
          notifyAll();
        }
      }
      else if (tc.isDebugEnabled())
        SibTr.debug(tc, "Thread not the current thread to unlock exclusively");
    }

    if (tc.isEntryEnabled())
      SibTr.exit(tc, "unlockExclusive");

  }
1052433
public boolean isLocked() {

		// always return false when lock is disabled

		if (disabled.get()) {
			return false;
		}

		// check if locked by current process

		if (locked.get()) {
			return true;
		}

		// check if locked by other process

		if (!lock.exists()) {
			return false;
		}

		long now = System.currentTimeMillis();
		long tsp = read();

		LOG.trace("Lock timestamp {} now {} for {}", tsp, now, webcam);

		if (tsp > now - INTERVAL * 2) {
			return true;
		}

		return false;
	}
914196
public function lock()
    {
        if (!$this->isLocked()) {
            $file = fopen($this->getFilePath(), 'w');
            if ($file) {
                fwrite($file, getmypid());
                fclose($file);
                return true;
            }
        }
        return false;
    }
109698
public synchronized void unlock()
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "unlock", this);

    // If the subscription locks are down to zero then notify the threads waiting
    // for the subscriptionTable lock.
    synchronized (iMutex)
    {
      // If we are exclusively locked, then just return, as long as
      // the thread that is calling is the thread that holds the
      // exclusive lock.
      if (iExclusivelyLocked && iExclusiveLockHolder == Thread.currentThread())
      {
        if (tc.isEntryEnabled())
          SibTr.exit(tc, "unlock");
        return;
      }

      // Decrement the lock count and notify the other threads if no 
      // one holds the lock any more.
      if (--iLockCount == 0)
        notifyAll();
        
      if (iLockCount < 0)
      {      
        if (tc.isEntryEnabled()) 
          SibTr.exit(tc, "unlock", "SIErrorException");
        
        SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
          new Object[] {
            "com.ibm.ws.sib.processor.utils.LockManager",
            "1:196:1.19" });
          
        throw new SIErrorException(
          nls.getFormattedMessage(
            "INTERNAL_MESSAGING_ERROR_CWSIP0001",
            new Object[] {
              "com.ibm.ws.sib.processor.utils.LockManager",
              "1:203:1.19" },
            null));
      }        
    }

    if (tc.isEntryEnabled())
      SibTr.exit(tc, "unlock");
  }
1030405
public function unlock () {
        if (!$this->beforeUnlock ()) {
            return false;
        }
        $redis = $this->getConnection ()->getClient ();
        $value = $redis->get ($this->name);
        $decimalPlaces = max (strlen (substr ($value , strpos ($value , "."))) , strlen (substr ($this->_expiresAt , strpos ($this->_expiresAt , ".")))) - 1;
        if (bccomp ($value , $this->_expiresAt , $decimalPlaces) == -1 && bccomp ($value , microtime (true) , $decimalPlaces) == 1) {
            return false;
        }


        $redis->delete ($this->name);
        $this->afterUnlock ();
        return true;
    }
2206
public function release(): bool
    {
        $success = true;
        if (is_resource($this->filePointer)) {
            // FIXME: The lockfile should be unlocked at this point but this will again lead to race conditions,
            // so we need to find out how to do this in a safe way. Keeping the lock files is very inode intensive
            // and should therefore change ASAP.
            if (flock($this->filePointer, LOCK_UN) === false) {
                $success = false;
            }
            fclose($this->filePointer);
        }

        return $success;
    }
565192
public function onDispatcherReady()
    {
        if ($this->dispatcher && $this->dispatcher->isReady()) {
            $context = $this->currentContext;
            $event = $this->currentEvent;
            $this->dispatcher = null;
            $this->currentContext = null;
            $this->currentEvent = null;
            $this->doCheckTransitions($context, $event);
            $this->mutex->releaseLock();
        }
    }