Пример #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);
     }
 }
Пример #2
0
        /**
         * Fork child process
         *
         * @param mixed $arg
         * @final
         */
        final private function Fork($arg)
        {
        	$pid = @pcntl_fork();
			if(!$pid) 
			{
			    try
			    {
                    $this->ProcessObject->StartThread($arg);
			    }
			    catch (Exception $err)
			    {
			        //Log::Log($err->getMessage(), E_CORE_ERROR);
			    }
				exit();
			}
			else
			{
			    
				//Log::Log("Child with PID# {$pid} successfully forked", E_NOTICE);
                    
			    $this->PIDs[] = $pid;
			}
        }