src/Storage/File/File.php
public function lock($lockType)
    {
        if (!$this->isOpened()) {
            return false;
        }

        if ($this->options["blocking"]) {
            return flock($this->handle, $lockType);
        } else {
            $tries = 0;
            do {
                if (flock($this->handle, $lockType | LOCK_NB)) {
                    return true;
                } else {
                    ++$tries;
                    usleep(self::LOCK_RETRY_WAIT);
                }
            } while ($tries < self::LOCK_MAX_TRIES);

            return false;
        }
    }
public function lock($lockType)
    {
        if (!$this->isOpened()) {
            return false;
        }

        if ($this->options["blocking"]) {
            return flock($this->handle, $lockType);
        } else {
            $tries = 0;
            do {
                if (flock($this->handle, $lockType | LOCK_NB)) {
                    return true;
                } else {
                    ++$tries;
                    usleep(self::LOCK_RETRY_WAIT);
                }
            } while ($tries < self::LOCK_MAX_TRIES);

            return false;
        }
    }
Obtains a file lock

@param int $lockType Lock type PHP constant
@return boolean true on successful lock, false otherwise