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;
        }
    }