Esempio n. 1
0
 public function loop($infinite = true)
 {
     do {
         $message = $this->messenger->next();
         $pid = pcntl_fork();
         if ($pid == -1) {
             $this->shutdown();
             exit(1);
         } elseif ($pid > 0) {
             pcntl_waitpid($pid, $status);
         } else {
             $this->onMessage($message);
             exit(0);
         }
     } while ($infinite);
 }