Example #1
0
 /**
  * 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;
 }
Example #2
0
 public function stop()
 {
     $this->base->stop();
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function stop()
 {
     $this->loop->stop();
     parent::stop();
 }