yii\mutex\Mutex::acquire PHP Method

acquire() public method

Acquires a lock by name.
public acquire ( string $name, integer $timeout ) : boolean
$name string of the lock to be acquired. Must be unique.
$timeout integer time to wait for lock to be released. Defaults to zero meaning that method will return false immediately in case lock was already acquired.
return boolean lock acquiring result.
    public function acquire($name, $timeout = 0)
    {
        if ($this->acquireLock($name, $timeout)) {
            $this->_locks[] = $name;
            return true;
        } else {
            return false;
        }
    }