Start the event execution.

@return int
555460
public function start()
    {
        $command = $this->buildCommand();
        $process = Process::fromStringCommand($command);

        $this->setProcess($process);
        $this->getProcess()->start(
            function ($type, $content): void {
                $this->wholeOutput[] = $content;
            }
        );

        if ($this->preventOverlapping) {
            $this->lock();
        }

        /** @var int $pid */
        $pid = $this->getProcess()
            ->getPid();

        return $pid;
    }
260747
public function start()
    {
        declare (ticks = 1);
        pcntl_signal(SIGINT, SIG_IGN, true);
        
        if (!$pipes = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP)) {
            throw new \RuntimeException('Failed to create socket pair');
        }
        
        $pid = pcntl_fork();
        
        if ($pid > 0) {
            if (function_exists('setproctitle')) {
                setproctitle('boris (master)');
            }
            
            fclose($pipes[0]);
            $client = new ReadlineClient($pipes[1]);
            $client->start($this->_prompt, $this->_historyFile);
        } elseif ($pid < 0) {
            throw new \RuntimeException('Failed to fork child process');
        } else {
            if (function_exists('setproctitle')) {
                setproctitle('boris (worker)');
            }
            
            fclose($pipes[1]);
            $worker = new EvalWorker($pipes[0]);
            $worker->setLocal($this->_exports);
            $worker->setStartHooks($this->_startHooks);
            $worker->setFailureHooks($this->_failureHooks);
            $worker->setInspector($this->_inspector);
            $worker->start();
        }
    }
451146
public static function Start()
	{
		// Retrieve the global variables
		if(!$argv) $argv = $_SERVER["argv"];

		// Get the console variables
		$functionName = $argv[1];
		$rows = explode(",", $argv[2]);
		$vars = array();
		foreach($rows as $row)
		{
			$parts = explode("=", $row);
			$vars[$parts[0]] = $parts[1];
		}

		// Prepare the console
		$console = new Console;

		// Run the console
		try
		{
			return $console->Run($functionName, $vars);
		}
		catch(\Exception $ex)
		{
			return "\nError: " . $ex->getMessage() . "\n";
		}
	}
544127
public function start()
    {
        $metaData = array("columns"=>array());

        if ($this->countTotal) {
            $totalQuery = $this->prepareParams($this->totalQuery, $this->sqlParams);
            $stm = $this->connection->prepare($totalQuery);
            $this->bindParams($stm, $this->sqlParams);
            $stm->execute();
            $error = $stm->errorInfo();
            if ($error[2]!=null) {
                throw new \Exception("Query Error >> [".$error[2]."] >> $totalQuery");
                return;
            }
            $row = $stm->fetch();
            $result = $row[0];
            $metaData['totalRecords'] = $result;
        }

        if ($this->countFilter) {
            $filterQuery = $this->prepareParams($this->filterQuery, $this->sqlParams);
            $stm = $this->connection->prepare($filterQuery);
            $this->bindParams($stm, $this->sqlParams);
            $stm->execute();
            $error = $stm->errorInfo();
            if ($error[2]!=null) {
                throw new \Exception("Query Error >> [".$error[2]."] >> $filterQuery");
                return;
            }
            $row = $stm->fetch();
            $result = $row[0];
            $metaData['filterRecords'] = $result;
        }
        $row = null;

        $query = $this->prepareParams($this->query, $this->sqlParams);
        // echo "pdodatasource start query=$query <br>";
        $stm = $this->connection->prepare($query);
        $this->bindParams($stm, $this->sqlParams);
        $stm->execute();

        $error = $stm->errorInfo();
        // if($error[2]!=null)
        if ($error[0]!='00000') {
            throw new \Exception("Query Error >> [".$error[2]."] >> $query");
            return;
        }

        $driver = strtolower($this->connection->getAttribute(PDO::ATTR_DRIVER_NAME));
        $metaSupportDrivers = array('dblib', 'mysql', 'pgsql', 'sqlite');
        $metaSupport = false;
        foreach ($metaSupportDrivers as $supportDriver) {
            if (strpos($driver, $supportDriver) !== false) {
                $metaSupport = true;
            }
        }
            
        if (!$metaSupport) {
            $row = $stm->fetch(PDO::FETCH_ASSOC);
            $cNames = empty($row) ? array() : array_keys($row);
            $numcols = count($cNames);
        } else {
            $numcols = $stm->columnCount();
        }

        // $metaData = array("columns"=>array());
        for ($i=0;$i<$numcols;$i++) {
            if (! $metaSupport) {
                $cName = $cNames[$i];
                $cType = $this->guessTypeFromValue($row[$cName]);
            } else {
                $info = $stm->getColumnMeta($i);
                $cName = $info["name"];
                $cType = $this->guessType($info["native_type"]);

            }
            $metaData["columns"][$cName] = array(
                "type"=>$cType,
            );
            switch($cType)
            {
            case "datetime":
                $metaData["columns"][$cName]["format"] = "Y-m-d H:i:s";
                break;
            case "date":
                $metaData["columns"][$cName]["format"] = "Y-m-d";
                break;
            case "time":
                $metaData["columns"][$cName]["format"] = "H:i:s";
                break;
            }
        }
                
        $this->sendMeta($metaData, $this);
        $this->startInput(null);
        
        $numberColumnList = array();
        foreach ($metaData["columns"] as $cName=>$cMeta) {
            if ($cMeta["type"]=="number") {
                array_push($numberColumnList, $cName);
            }
        }
                        
        if (! isset($row)) {
            $row=$stm->fetch(PDO::FETCH_ASSOC);
        }
            
        while ($row) {
            // print_r($row); echo '<br>';
            foreach ($numberColumnList as $cName) {
                    $row[$cName]+=0;
            }
            $this->next($row, $this);
            $row=$stm->fetch(PDO::FETCH_ASSOC);
        }
        $this->endInput(null);
    }
1224250
public function start()
    {
        if ($this->state === static::STATE_ACTIVE) {
            return true;
        }

        $this->doStart();

        if ($this->state === static::STATE_EXPIRED) {
            $this->restart();
        }

        return true;
    }
846634
public function start()
    {
        if (!empty($this->pid) && $this->isRunning()) {
            throw new \LogicException("the process is already running");
        }

        $callback = $this->getCallable();

        $pid = pcntl_fork();
        if ($pid < 0) {
            throw new \RuntimeException("fork error");
        } elseif ($pid > 0) {
            $this->pid = $pid;
            $this->running = true;
            $this->started = true;
        } else {
            $this->pid = getmypid();
            $this->signal();
            foreach ($this->signal_handlers as $signal => $handler) {
                pcntl_signal($signal, $handler);
            }
            call_user_func($callback);
            exit(0);
        }
    }
1072749
public function actionStart()
    {
        if ($this->clearLogs) {
            if (file_exists(static::$logFile)) {
                unlink(static::$logFile);
            }
            if (file_exists(static::$errorLogFile)) {
                unlink(static::$errorLogFile);
            }
        }

        $message = 'Starting Yii 2 Daemon ' . $this->version . '... ';

        if ($this->_getPid() === false) {
            $this->_getWorkers();
            if (!static::$_workersData) {
                $message .= 'No tasks found. Stopping!';
                echo $message . PHP_EOL;
                $this->_log($message);
                return static::EXIT_CODE_ERROR;
            }
            if ($this->_meetRequerements) {
                pcntl_signal(SIGTERM, ['inpassor\daemon\Controller', 'signalHandler']);
                pcntl_signal(SIGINT, ['inpassor\daemon\Controller', 'signalHandler']);
                pcntl_signal(SIGCHLD, ['inpassor\daemon\Controller', 'signalHandler']);
            }
        } else {
            $message .= 'Service is already running!';
            echo $message . PHP_EOL;
            $this->_log($message);
            return static::EXIT_CODE_NORMAL;
        }

        $this->_pid = $this->_meetRequerements ? pcntl_fork() : 0;
        if ($this->_pid == -1) {
            $message .= 'Could not start service!';
            echo $message . PHP_EOL;
            $this->_log($message);
            return static::EXIT_CODE_ERROR;
        } elseif ($this->_pid) {
            file_put_contents($this->_pidFile, $this->_pid);
            return static::EXIT_CODE_NORMAL;
        }
        if ($this->_meetRequerements) {
            posix_setsid();
        }

        $message .= 'OK.';
        echo $message . PHP_EOL;
        $this->_log($message);

        if ($this->_meetRequerements) {
            declare(ticks=1);
        };

        $previousSec = null;

        while (!static::$_stop) {
            $currentSec = date('s');
            $tickPlus = $currentSec === $previousSec ? 0 : 1;
            if ($tickPlus) {
                foreach (static::$_workersData as $workerUid => $workerData) {
                    if ($workerData['tick'] >= $workerData['delay']) {
                        static::$_workersData[$workerUid]['tick'] = 0;
                        $pid = 0;
                        if ($this->_meetRequerements) {
                            if (!isset(static::$workersPids[$workerUid])) {
                                static::$workersPids[$workerUid] = [];
                            }
                            $pid = (count(static::$workersPids[$workerUid]) < $workerData['maxProcesses']) ? pcntl_fork() : -2;
                        }
                        if ($pid == -1) {
                            $this->_log('Could not launch worker "' . $workerUid . '"');
                        } elseif ($pid == -2) {
                            $this->_log('Max processes exceed for launch worker "' . $workerUid . '"');
                        } elseif ($pid) {
                            static::$workersPids[$workerUid][] = $pid;
                        } else {

                            $config = ArrayHelper::merge(static::$_workersConfig[$workerUid] ?? [], [
                                'uid' => $workerUid
                            ]);

                            /** @var \inpassor\daemon\Worker $worker */
                            $worker = \Yii::createObject($config);
                            $worker->run();

                            if ($this->_meetRequerements) {
                                return static::EXIT_CODE_NORMAL;
                            }
                        }
                    }
                    static::$_workersData[$workerUid]['tick'] += $tickPlus;
                }
            }
            usleep(500000);
            $previousSec = $currentSec;
        }
        return static::EXIT_CODE_NORMAL;
    }
355609
public function begin()
    {
        $this->beginId++;
        $this->nowAffairId = $this->beginId;
        $this->startBeginTime = getMillisecond();
        return $this->beginId;
    }
578830
public function start() : int
    {
        $pathToServerScript = $this->config['server_path'];
        if (!file_exists($pathToServerScript)) {
            throw new ControlException('Server script not found. Check server_path in your config file.');
        }

        // check if process is already running:
        $serverPid = $this->getServerPid();
        if ($serverPid !== 0) {
            return $serverPid;
        }

        // startup server:
        $phpPath = $this->config['php_path'];
        $startupCommand = escapeshellcmd($phpPath . ' ' . $pathToServerScript) . ' > /dev/null 2>&1 &';
        exec($startupCommand);

        // return process id:
        $pid = $this->getServerPid();
        if (empty($pid)) {
            throw new ControlException('Could not start server. (Empty Pid)');
        }
        return $pid;
    }
1008232
public function start()
	{
		if ($this->getState() === 'active')
		{
			return;
		}

		$this->_start();

		$this->setState('active');

		// Initialise the session
		$this->_setCounter();
		$this->_setTimers();

		// Perform security checks
		$this->_validate();

		if ($this->dispatcher instanceof DispatcherInterface)
		{
			$this->dispatcher->triggerEvent('onAfterSessionStart');
		}
	}
262633
protected function start()
    {
        $this->client->executeCommand(
            $this->client->createCommand('MONITOR')
        );
        $this->valid = true;
    }
86196
public function start()
    {
        $cmd = $this->command->getPreparedCommand();
        $cwd = realpath(CRAFT_BASE_PATH);

        $process = Process::fromShellCommandline($cmd, $cwd);

        try {
            $process->run();
        } catch (\Symfony\Component\Process\Exception\RuntimeException $e) {
            $e = new RuntimeException($e->getMessage());
            $e->setProcess($process);
            throw $e;
        } catch (\Symfony\Component\Process\Exception\LogicException $e) {
            $e = new LogicException($e->getMessage());
            $e->setProcess($process);
            throw $e;
        }

        return $process;
    }
1068065
public function start()
    {
        if ($this->isRunning()) {
            throw new LogicException('Process is already running');
        }

        $this->reset();

        $cmd = $this->cmd;
        if (substr($cmd, 0, 4) == 'php ') {
            $php = PHP_BINARY ?: PHP_BINDIR . '/php';
            $cmd = $php . substr($cmd, 3);
        }

        $descriptorspec = [
            0 => ['pipe', 'r'], // STDIN
            1 => ['pipe', 'w'], // STDOUT
            2 => ['pipe', 'w']  // STDERR
        ];

        $options = [
            'suppress_errors' => true,
            'binary_pipes'    => true,
        ];

        $this->process = proc_open($cmd, $descriptorspec, $this->pipes, base_path(), $this->env, $options);

        if (!is_resource($this->process)) {
            throw new RuntimeException('Unable to launch a new process.');
        }
    }
442052
public function start()
    {
        declare (ticks = 1);
        register_shutdown_function(array($this, "shutdown"));
        pcntl_signal(SIGTERM, array($this, "signalHandler"));
        pcntl_signal(SIGINT, array($this, "signalHandler"));

        $this->output->writeln("<info>Starting <comment>".$this->config->getName()."</comment>.</info>");

        $this->dispatcher->dispatch(WorkerEvents::STARTED, new WorkerStartedEvent($this));

        // A dummy timer to keep a process on a system.
        $this->eventLoop->addPeriodicTimer(10, function () {});

        $this->output->writeln('<info>Successfully booted. Quit working with CONTROL-C.</info>');

        // Start event loop.
        $this->eventLoop->run();
    }
765214
public function start()
    {
        $this->bufferized = true;
        $newHelper = clone $this;
        $this->bufferized = false;
        return $newHelper;
    }
510223
public function getStartDate() : ?int 
    {
        if ( ! $this->hasStartDate()) {
            $this->setStartDate($this->getDefaultStartDate());
        }
        return $this->startDate;
    }
586298
public function start()
	{
		if ($this->state === 'active')
		{
			return;
		}

		$this->_start();

		$this->state = 'active';

		// Initialise the session
		$this->_setCounter();
		$this->_setTimers();

		// Perform security checks
		$this->_validate();

		if ($this->dispatcher instanceof Dispatcher)
		{
			$this->dispatcher->trigger('onAfterSessionStart');
		}
	}