The daemon's main run method. It should not be necessary to override,
instead use the main(), iterate() and cleanup() methods to implement
the daemons custom functionality.

@return void
@see \Thread::run()
776845
public function run()
    {

        try {
            // register shutdown handler
            register_shutdown_function($this->getDefaultShutdownMethod());

            // bootstrap the daemon
            $this->bootstrap();

            // invoke the execute method
            try {
                $this->execute();
            } catch (\Exception $e) {
                $this->log(LogLevel::ERROR, $e->__toString());
            }

            // clean up the instances and free memory
            $this->cleanUp();

        } catch (\Exception $e) {
            $this->log(LogLevel::ERROR, $e->__toString());
        }
    }
38805
public function run()
    {
        $request = Request::createFromGlobals();
        $response = $this->handle($request);
        $response->send();

        $this->invokeFinish([], [$this, $request, $response]);
    }
1018594
public function run()
    {
        require __DIR__.'/../../../../vendor/autoload.php';
        $handler_pool = new \Pool($this->API->settings['threading']['handler_workers']);
        $this->ready = true;
        while ($this->API->run_workers) {
            try {
                $this->API->datacenter->sockets[$this->current]->reading = true;
                //$this->logger->logger('RECEIVING');
                $error = $this->API->recv_message($this->current);
                $this->logger->logger('NOW HANDLE');
                $handler_pool->submit(new SocketHandler($this->API, $this->current, $error));
                $this->logger->logger('SUBMITTED');
                $this->API->datacenter->sockets[$this->current]->reading = false;
            } catch (\danog\MadelineProto\NothingInTheSocketException $e) {
                //$this->logger->logger('Nothing in the socket for dc '.$this->current, \danog\MadelineProto\Logger::VERBOSE);
            }
        }
        while ($number = $handler_pool->collect()) {
            $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['shutting_down_handler_pool'], $this->current, $number), \danog\MadelineProto\Logger::NOTICE);
        }
        $this->setGarbage();
    }
190429
public function run()
    {
        $this->log("Server listening on {$this->host}:{$this->port}");
        $this->socket->listen($this->port, $this->host);
        $this->loop->run();
    }
1186846
public function run()
    {
        $this->setUserAndGroup();

        $out = $this->out;
        $err = $this->err;
        $process = new \Symfony\Component\Process\Process($this->cmd, null, null, null, null);
        $process->run(function ($type, $buffer) use ($out, $err) {
            if ($type == \Symfony\Component\Process\Process::ERR) {
                $err->error($buffer);
            } else {
                $out->info($buffer);
            }
        });
    }
580006
public function run()
    {
        foreach ($this->pubsub as $message) {
            $kind = $message->kind;

            if ($kind !== Consumer::MESSAGE && $kind !== Consumer::PMESSAGE) {
                if (isset($this->subscriptionCallback)) {
                    $callback = $this->subscriptionCallback;
                    call_user_func($callback, $message);
                }

                continue;
            }

            if (isset($this->callbacks[$message->channel])) {
                $callback = $this->callbacks[$message->channel];
                call_user_func($callback, $message->payload);
            } elseif (isset($this->defaultCallback)) {
                $callback = $this->defaultCallback;
                call_user_func($callback, $message);
            }
        }
    }
756942
public function run() {
		$transactions = Transaction::get_runnable();

		foreach ($transactions as $transaction) {
			$transaction->lock();
			self::run_transaction($transaction);
			$transaction->unlock();
		}
	}
320095
public function run()
    {
        $this->setupSignalHandlers();

        $procs = [];
        while (true) {
            $jobs = $this->runner->getJobs();
            foreach ($jobs as $job) {
                if (! array_key_exists($job->identifier(), $procs)) {
                    $procs[$job->identifier()] = [];
                }
                while (count($procs[$job->identifier()]) > $job->numWorkers()) {
                    // Stopping an excessive child.
                    echo 'Stopping an excessive child.' . PHP_EOL;
                    $proc = array_pop($procs[$job->identifier()]);
                    $status = proc_get_status($proc);
                    // Keep sending SIGTERM until the child exits.
                    while ($status['running'] === true) {
                        @proc_terminate($proc);
                        usleep(50000);
                        $status = proc_get_status($proc);
                    }
                    @proc_close($proc);
                }
                for ($i = 0; $i < $job->numWorkers(); $i++) {
                    $needStart = false;
                    if (array_key_exists($i, $procs[$job->identifier()])) {
                        $status = proc_get_status($procs[$job->identifier()][$i]);
                        if ($status['running'] !== true) {
                            $needStart = true;
                        }
                    } else {
                        $needStart = true;
                    }
                    if ($needStart) {
                        echo 'Starting a child.' . PHP_EOL;
                        $procs[$job->identifier()][$i] = proc_open(
                            sprintf('%s %d', $this->command, $job->id()),
                            $this->descriptorSpec,
                            $pipes
                        );
                    }
                }
            }
            usleep(1000000); // Reload the config after 1 second
            pcntl_signal_dispatch();
            if ($this->shutdown) {
                echo 'Shutting down, waiting for the children' . PHP_EOL;
                foreach ($procs as $k => $v) {
                    foreach ($v as $proc) {
                        $status = proc_get_status($proc);
                        // Keep sending SIGTERM until the child exits.
                        while ($status['running'] === true) {
                            @proc_terminate($proc);
                            usleep(50000);
                            $status = proc_get_status($proc);
                        }
                        @proc_close($proc);
                    }
                }
                echo 'BatchDaemon exiting' . PHP_EOL;
                exit;
            }
            // Reload the config
            $this->runner->loadConfig();
        }
    }
989228
protected function run()
    {
        Daemon::$process = $this;

        $this->prepareSystemEnv();
        class_exists('Timer'); // ensure loading this class
        gc_enable();

        $this->callbacks = new StackCallbacks;

        /*
         * @todo This line must be commented according to current libevent binding implementation.
         * May be uncommented in future.
         */
        //EventLoop::init()

        if (EventLoop::$instance) {
            $this->registerEventSignals();
        } else {
            $this->registerSignals();
        }

        $this->workers = new Collection();
        $this->collections['workers'] = $this->workers;
        $this->ipcthreads = new Collection;
        $this->collections['ipcthreads'] = $this->ipcthreads;

        Daemon::$appResolver->preload(true);

        $this->spawnIPCThread();
        $this->spawnWorkers(
            min(
                Daemon::$config->startworkers->value,
                Daemon::$config->maxworkers->value
            )
        );
        $this->timerCb = function ($event) use (&$cbs) {
            static $c = 0;

            ++$c;

            if ($c > 0xFFFFF) {
                $c = 1;
            }

            if (($c % 10 == 0)) {
                gc_collect_cycles();
            }

            if (!$this->lastMpmActionTs || ((microtime(true) - $this->lastMpmActionTs) > $this->minMpmActionInterval)) {
                $this->callMPM();
            }
            if ($event) {
                $event->timeout();
            }
        };

        if (EventLoop::$instance) { // we are using libevent in Master
            Timer::add($this->timerCb, 1e6 * Daemon::$config->mpmdelay->value, 'MPM');
            EventLoop::$instance->run();
        } else { // we are NOT using libevent in Master
            $lastTimerCall = microtime(true);
            $func = $this->timerCb;
            while (!$this->breakMainLoop) {
                $this->callbacks->executeAll($this);
                if (microtime(true) > $lastTimerCall + Daemon::$config->mpmdelay->value) {
                    $func(null);
                    $lastTimerCall = microtime(true);
                }
                $this->sigwait();
            }
        }
    }
467165
public function run()
    {
        parent::run();

        while (\count($this->running) || \count($this->pending)) {
            foreach ($this->running as $key => $test) {
                try {
                    if (!$this->testIsStillRunning($test)) {
                        unset($this->running[$key]);
                        $this->releaseToken($key);
                    }
                } catch (\Exception $e) {
                    if ($this->options->verbose) {
                        echo "An error for $key: {$e->getMessage()}" . PHP_EOL;
                        echo "Command: {$test->getLastCommand()}" . PHP_EOL;
                        echo 'StdErr: ' . $test->getStderr() . PHP_EOL;
                        echo 'StdOut: ' . $test->getStdout() . PHP_EOL;
                    }
                    throw $e;
                }
            }
            $this->fillRunQueue();
            usleep(10000);
        }
        $this->complete();
    }
217440
public function run()
    {
        if ($this->count()) {

            $request = server_request();

            foreach ($this->registry as $offset => $handler) {
                $this->process($request, $handler);
            }
        }
    }
141518
public function run()
    {
        $this->loadMiddleware();

        //~ Default response
        $response = new HttpMessage\Response();
        //$response->getBody()->write('-- static --');

        //~ Get response
        $stack    = new HttpMiddleware\Stack($response, $this->middleware);
        $response = $stack->process(HttpMessage\ServerRequest::createFromGlobal());

        //~ Send response
        (new HttpMessage\ResponseSender($response))->send();
    }
1137111
public function run() {
        $helperSet = $this->getConsoleHelperSet();
        ConsoleRunner::run($helperSet, $this->getConsoleCommands($helperSet));
    }
1070879
public function run(): bool
    {
        if ($this->startup) {
            $this->logger->debug('Calling startup callback');
            call_user_func($this->startup, $this);
        }

        $actions = implode(', ', array_keys($this->callbacks));
        $this->logger->info("Component running with callbacks for $actions");
        $this->executor->execute(
            $this->apiFactory,
            $this->input,
            $this->callbacks,
            $this->error
        );

        if ($this->shutdown) {
            $this->logger->debug('Calling shutdown callback');
            call_user_func($this->shutdown, $this);
        }

        return true;
    }
328127
public function run()
    {
        $this->setStatus(Job::STATUS_RUNNING);

        $this->redis->zadd(Queue::redisKey($this->queue, 'running'), time(), $this->payload);
        Stats::incr('running', 1);
        Stats::incr('running', 1, Queue::redisKey($this->queue, 'stats'));

        Event::fire(Event::JOB_RUNNING, $this);
    }
731337
def run_daemon(self):
        
        try:
            self.daemon_runner.do_action()
        except daemon.runner.DaemonRunnerStopFailureError:
            self.onStopFail()
        except SystemExit:
            self.onExit()
222357
public function run()
	{
		$container = $this->createContainer();
		$this->export( $container, false );
		$container->close();
	}