/** * Sets up forking. * * @param fork_daemon $fork_daemon Fork daemon object. * @return void */ public function setUpForking(fork_daemon $fork_daemon) { $this->fork_daemon = $fork_daemon; $this->fork_daemon->max_children_set($this->getNumChildren()); $this->fork_daemon->register_child_run(array($this, 'processWork')); $this->fork_daemon->register_parent_exit(array($this, 'cleanUp')); $this->fork_daemon->max_work_per_child_set($this->getItemCount()); }