Called when the request starts sleep
@return void
19977
public function onSleep()
    {
        Daemon::$context = null;
        $this->running = false;
        unset($_SESSION, $_GET, $_POST, $_COOKIE);
        Daemon::$process->setState(Daemon::WSTATE_IDLE);
    }
271756
public function start(): void
    {
        // In case Lambda stopped our process (e.g. because of a timeout) we need to make sure PHP-FPM has stopped
        // as well and restart it
        if ($this->isReady()) {
            $this->killExistingFpm();
        }

        if (! is_dir(dirname(self::SOCKET))) {
            mkdir(dirname(self::SOCKET));
        }

        /**
         * --nodaemonize: we want to keep control of the process
         * --force-stderr: force logs to be sent to stderr, which will allow us to send them to CloudWatch
         */
        $this->fpm = new Process(['php-fpm', '--nodaemonize', '--force-stderr', '--fpm-config', $this->configFile]);
        $this->fpm->setTimeout(null);
        $this->fpm->start(function ($type, $output): void {
            // Send any PHP-FPM log to CloudWatch
            echo $output;
        });

        $connection = new UnixDomainSocket(self::SOCKET, 1000, 30000);
        $this->client = new Client($connection);

        $this->waitUntilReady();
    }
1235665
public function onKernelRequest()
    {
        if (!is_null($this->host)) {
            $this->router->getContext()->setHost($this->host);
        }

        if (!is_null($this->portHttp)) {
            $this->router->getContext()->setHttpPort($this->portHttp);
        }

        if (!is_null($this->portHttps)) {
            $this->router->getContext()->setHttpsPort($this->portHttps);
        }
    }
189024
public function stop_request_timer() {
		if ( ! is_null( $this->request_start_time ) ) {
			$this->request_time += microtime( true ) - $this->request_start_time;
		}
		$this->request_start_time = null;
	}
776483
function start(): void {
        if($this->nativeHrtime) {
            $this->timer = \hrtime(true);
        } elseif($this->hrtime) {
            $this->timer->start();
        } else {
            $this->timer = \microtime(true);
        }
    }
1052841
def sleep(self):
        """"""
        logger.debug("Sleep the controller")
        self.write(Registers.MODE_1, self.mode_1 | (1 << Mode1.SLEEP))
1170322
function(){
            var i = 0
                ,l = this._bodies.length
                ;

            for ( i = 0; i < l; i++ ){
                this._bodies[ i ].sleep( false );
            }
        }
89063
protected function startQuery()
    {
        $sessionOK = $this->initialiseSession();
        if ($sessionOK) {
            $searchReplyString = $this->fetchURL($this->pazpar2SearchURL());
            $searchReply = GeneralUtility::xml2array($searchReplyString);

            if ($searchReply) {
                $status = $searchReply['status'];
                if ($status === 'OK') {
                    $this->queryIsRunning = true;
                } else {
                    GeneralUtility::devLog('pazpar2 search command status is not "OK" but "' . $status . '"', 'pazpar2', 3);
                }
            } else {
                GeneralUtility::devLog('could not parse pazpar2 search reply', 'pazpar2', 3);
            }
        }
    }
1256194
public function execute()
    {
        $queue = P\queue();

        while ($this->handles || !$queue->isEmpty()) {
            // If there are no transfers, then sleep for the next delay
            if (!$this->active && $this->delays) {
                usleep($this->timeToNext());
            }
            $this->tick();
        }
    }
217025
private function start()
    {
        # Starting session.
        # Here making session active to every request.
        new Session();

        $this->setBaseURL();
        $this->setRequestURI();
        $this->fetchRouteRules();
        $this->establishConnection();
        $this->locateMethod();
        $this->invokeMethod();
    }
1084418
public function onReady()
    {
        if ($this->pool->identd) {
            /** @noinspection PhpParamsInspection */
            $this->getSocketName();
            $this->pool->identd->registerPair($this->locAddr, $this->locPort, ['UNIX', $this->user]);
        }
        list($this->nick, $this->realname) = explode('/', $this->path . '/John Doe');
        $this->command('USER', $this->user, 0, '*', $this->realname);
        $this->command('NICK', $this->nick);
        if (mb_orig_strlen($this->password)) {
            $this->message('NickServ', 'IDENTIFY ' . $this->password);
        }
    }
877825
public function start()
    {
        if (!$this->active()) {
            session_start();
            $this->session =& $_SESSION;
        } elseif (!isset($this->session)) {
            $this->session =& $_SESSION;
        }
    }
1107133
public function onWakeup()
    {
        parent::onWakeup();
        if (!Daemon::$obInStack) { // preventing recursion
            @ob_flush();
        }
        $_GET = &$this->attrs->get;
        $_POST = &$this->attrs->post;
        $_COOKIE = &$this->attrs->cookie;
        $_REQUEST = &$this->attrs->request;
        $_SESSION = &$this->attrs->session;
        $_FILES = &$this->attrs->files;
        $_SERVER = &$this->attrs->server;
    }
770254
protected function slowdownRequests()
    {
        $sleepInMicroseconds = ((int) $this->rateLimitRemaining === 0)
            ? $this->rateLimitReset * 1000000
            : $this->rateLimitReset / $this->rateLimitRemaining * 1000000;

        usleep((int) $sleepInMicroseconds);
    }
420642
public function start()
    {

        // we need the session to be started
        if ($this->isStarted()) {
            return;
        }

        // create a new cookie with the session values
        $cookie = new HttpCookie(
            $this->getName(),
            $this->getId(),
            $this->getLifetime(),
            $this->getMaximumAge(),
            $this->getDomain(),
            $this->getPath(),
            $this->isSecure(),
            $this->isHttpOnly()
        );

        // start the session and set the started flag
        $this->getSession()->start();

        // add the cookie to the response
        $this->getRequest()->setRequestedSessionId($this->getId());
        $this->getResponse()->addCookie($cookie);
    }
745414
public function handleStartRequest(StartRequest $startRequest): void
    {
        $this->requestStart = Carbon::now();
        $this->requestStartPrecise = $this->getTime();
    }
979101
protected void sleep() {
    try {
      Thread.sleep(sleepIntervalInMillis);
    } catch (InterruptedException exception) {
      Thread.currentThread().interrupt();
      throw new SelendroidException(exception);
    }
  }