@@ -97,7 +97,7 @@ public static function fork($id = 0, callable $childHandler = null)
9797 $ pid = getmypid ();
9898
9999 if ($ childHandler ) {
100- call_user_func ( $ childHandler, $ id , $ pid );
100+ $ childHandler( $ id , $ pid );
101101 }
102102
103103 } else {
@@ -122,7 +122,7 @@ public static function wait(callable $onExit)
122122 while (($ pid = pcntl_waitpid (-1 , $ status , WNOHANG )) >= 0 ) {
123123 if ($ pid ) {
124124 // ... (callback, pid, exitCode, status)
125- call_user_func ( $ onExit, $ pid , pcntl_wexitstatus ($ status ), $ status );
125+ $ onExit( $ pid , pcntl_wexitstatus ($ status ), $ status );
126126 } else {
127127 usleep (50000 );
128128 }
@@ -357,21 +357,21 @@ public static function afterDo($s, callable $handler)
357357 pcntl_alarm(-1);
358358 }
359359 });*/
360- self ::signal (SIGALRM , $ handler );
360+ self ::installSignal (SIGALRM , $ handler );
361361
362362 // self::alarm($s);
363363 pcntl_alarm ($ s );
364364 }
365365
366366 /**
367367 * install signal
368- * @param int $sigal e.g: SIGTERM SIGINT(Ctrl+C) SIGUSR1 SIGUSR2 SIGHUP
368+ * @param int $signal e.g: SIGTERM SIGINT(Ctrl+C) SIGUSR1 SIGUSR2 SIGHUP
369369 * @param callable $handler
370370 * @return bool
371371 */
372- public static function installSignal ($ sigal , callable $ handler )
372+ public static function installSignal ($ signal , callable $ handler )
373373 {
374- return pcntl_signal ($ sigal , $ handler , false );
374+ return pcntl_signal ($ signal , $ handler , false );
375375 }
376376
377377 /**
0 commit comments