public static spawnMaster ( ) : null | integer | ||
리턴 | null | integer | - success |
public static function spawnMaster()
{
Daemon::$masters->push($thread = new Thread\Master());
$thread->start();
if (-1 === $thread->getPid()) {
Daemon::log('could not start master');
exit(0);
}
return $thread->getPid();
}
/** * Start master. * @return void */ public static function start() { if (Bootstrap::$pid && Thread\Generic::ifExistsByPid(Bootstrap::$pid)) { Daemon::log('[START] phpDaemon with pid-file \'' . Daemon::$config->pidfile->value . '\' is running already (PID ' . Bootstrap::$pid . ')'); exit(6); } Daemon::init(); $pid = Daemon::spawnMaster(); file_put_contents(Daemon::$config->pidfile->value, $pid); }