protected function breakMainLoopCheck()
    {
        $time = microtime(true);

        if ($this->terminated || $this->breakMainLoop) {
            EventLoop::$instance->stop();
            return;
        }

        if ($this->shutdown) {
            EventLoop::$instance->stop();
            return;
        }

        if ($this->reload) {
            return;
        }

        if (Daemon::$config->maxmemoryusage->value > 0
            && (memory_get_usage(true) > Daemon::$config->maxmemoryusage->value)
        ) {
            $this->log('\'maxmemory\' exceed. Graceful shutdown.');

            $this->gracefulRestart();
        }

        if (Daemon::$config->maxrequests->value > 0
            && ($this->reqCounter >= Daemon::$config->maxrequests->value)
        ) {
            $this->log('\'max-requests\' exceed. Graceful shutdown.');

            $this->gracefulRestart();
        }

        if (Daemon::$config->maxidle->value
            && $this->timeLastActivity && ($time - $this->timeLastActivity > Daemon::$config->maxidle->value)
        ) {
            $this->log('\'maxworkeridle\' exceed. Graceful shutdown.');

            $this->gracefulRestart();
        }

        if ($this->update === true) {
            $this->update = false;
            $this->update();
        }
    }