Эх сурвалжийг харах

check pcntl_get_last_error and Task optimization

walkor 11 жил өмнө
parent
commit
805bd2472d

+ 1 - 1
workerman/Core/Lib/Task.php

@@ -50,8 +50,8 @@ class Task
      */
     public static function signalHandle()
     {
-        self::tick();
         pcntl_alarm(1);
+        self::tick();
     }
     
     

+ 2 - 1
workerman/Core/Master.php

@@ -614,7 +614,8 @@ class Master
             // 出错
             if($pid < 0)
             {
-                self::notice('pcntl_waitpid return '.$pid.' and pcntl_get_last_error = ' . pcntl_get_last_error());
+                $last_error = function_exists('pcntl_get_last_error') ? pcntl_get_last_error() : 'function pcntl_get_last_error not exists';
+                self::notice('pcntl_waitpid return '.$pid.' and pcntl_get_last_error = ' . $last_error);
                 return $pid;
             }
     

+ 3 - 0
workerman/Core/SocketWorker.php

@@ -211,6 +211,9 @@ abstract class SocketWorker extends AbstractWorker
         
         // 初始化事件轮询库
         $this->event = new $this->eventLoopName();
+        
+        // 初始化任务系统
+        \Man\Core\Lib\Task::init($this->event);
     }