Beispiel #1
0
 /**
  * Fork child process
  *
  * @param mixed $arg
  * @final
  */
 private final function Fork($arg)
 {
     $pid = @pcntl_fork();
     if (!$pid) {
         try {
             if ($this->ProcessObject->IsDaemon) {
                 $this->DemonizeProcess();
             }
             $this->ProcessObject->StartThread($arg);
         } catch (\Exception $err) {
             $this->Logger->error($err->getMessage());
         }
         exit;
     } else {
         if ($this->PIDDir) {
             $this->Logger->debug("Touch thread PID file {$pid}");
             touch($this->PIDDir . "/" . $pid);
         }
         $this->Logger->debug("Child with PID# {$pid} successfully forked");
         $this->PIDs[$pid] = array("start_time" => time(), "pid" => $pid);
     }
 }