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']); }
protected function runChilds() { $count = $this->getWorkerCount(); for ($i = 0; $i < $count; $i++) { $closure = $this->getChildCallable(); if ($this->isForkMode()) { $this->processManager->fork($closure); } else { $this->processManager->spawn($closure); } } }