/**
* Spawn IPC process
* @param $n - integer - number of workers to spawn
* @return boolean - success
*/
protected function spawnIPCThread()
{
if (FileSystem::$supported) {
eio_event_loop();
}
$thread = new IPC();
$this->ipcthreads->push($thread);
$this->callbacks->push(function ($self) use($thread) {
$thread->start();
$pid = $thread->getPid();
if ($pid < 0) {
Daemon::$process->log('could not fork IPCThread');
} elseif ($pid === 0) {
// worker
$this->log('Unexcepted execution return to outside of Thread->start()');
exit;
}
});
if ($this->eventBase) {
$this->eventBase->stop();
}
return true;
}