| @@ 53-57 (lines=5) @@ | ||
| 50 | public function reload($block = true) |
|
| 51 | { |
|
| 52 | $old_processes = $this->processes; |
|
| 53 | for ($i = 0; $i < $this->max; $i++) { |
|
| 54 | $process = new Process($this->runnable); |
|
| 55 | $process->start(); |
|
| 56 | $this->processes[$process->getPid()] = $process; |
|
| 57 | } |
|
| 58 | ||
| 59 | foreach ($old_processes as $process) { |
|
| 60 | $process->shutdown(); |
|
| @@ 99-103 (lines=5) @@ | ||
| 96 | // create sub process and run |
|
| 97 | if ($alive_count < $this->max) { |
|
| 98 | $need = $this->max - $alive_count; |
|
| 99 | for ($i = 0; $i < $need; $i++) { |
|
| 100 | $process = new Process($this->runnable); |
|
| 101 | $process->start(); |
|
| 102 | $this->processes[$process->getPid()] = $process; |
|
| 103 | } |
|
| 104 | } |
|
| 105 | } |
|
| 106 | } |
|