public function __construct() { $this->_shell_count = 0; $this->_cmd_queue = array(); $this->_runing_list = array(); $this->_spare_time = array(); $this->_run_path = dirname(dirname(__FILE__)) . "/run.php"; Process::onSysEvent(SIGCHLD, EventInterface::EV_SIGNAL, array($this, 'sig_child')); }
<?php define('FLIGHT_ROOT', dirname(dirname(__DIR__)) . "/includes/flight"); define('BOOT_FILE', FLIGHT_ROOT . "/boot/boot.php"); require_once BOOT_FILE; use rpc\Rpcserver; use rpc\Rpcmaster; use flight\Flight; use cli\proc\Process; use cli\events\EventInterface; Flight::set('app.root', FLIGHT_ROOT); Process::init(); $server = new Rpcserver(); $server->schema('tcp')->host(Flight::conf()->get('cli.sys.localhost'))->port(Flight::conf()->get('cli.sys.localport'))->create(); $rpc_master = new Rpcmaster(); Process::onSysEvent($server->getSocket(), EventInterface::EV_READ, array($rpc_master, 'handle')); Process::loop();