wait() public method

Suspends execution of the current process until all children has exited, or until a signal is delivered whose action is to terminate the current process.
public wait ( )
Example #1
0
 /**
  * {@inheritdoc} This dispatcher defers worker timeout to post-dispatch.
  *
  * @return void
  */
 public function run()
 {
     if ($this->manager->count() >= $this->max_workers) {
         $this->manager->wait();
     } elseif ($this->queue->count()) {
         $this->dispatch($this->queue->pop());
     }
 }
Example #2
0
 public function run()
 {
     $this->setProcessTitle('running');
     $this->parseCommandLine();
     $this->demonize();
     $this->runChilds();
     $this->setProcessTitle('idle');
     $this->processManager->wait();
     $this->exitApp(self::SUCCESS_EXIT);
 }
 public function testReSpawnedProcessHasPersistSharedMemorySegment()
 {
     $process = $this->manager->spawn(function (Process $p) {
         $sm = $p->getSharedMemory();
         $sm['spawnCount'] += 1;
         $exitCode = $sm['spawnCount'] == 1 ? -1 : 0;
         exit($exitCode);
     });
     $this->manager->wait();
     $this->assertEquals(2, $process->getSharedMemory()['spawnCount']);
 }