NinjaMutex\Lock\FlockLock::getLock PHP Method

getLock() protected method

protected getLock ( string $name, boolean $blocking ) : boolean
$name string
$blocking boolean
return boolean
    protected function getLock($name, $blocking)
    {
        if (!$this->setupFileHandle($name)) {
            return false;
        }
        $options = LOCK_EX;
        // Check if we don't want to wait until lock is acquired
        if (!$blocking) {
            $options |= LOCK_NB;
        }
        if (!flock($this->files[$name], $options)) {
            return false;
        }
        return true;
    }