diff options
Diffstat (limited to 'pts-core/objects/pts_module.php')
-rw-r--r-- | pts-core/objects/pts_module.php | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/pts-core/objects/pts_module.php b/pts-core/objects/pts_module.php index 18a8a01..f897078 100644 --- a/pts-core/objects/pts_module.php +++ b/pts-core/objects/pts_module.php @@ -92,27 +92,32 @@ class pts_module } public static function pts_timed_function($time, $function) { - if($time < 5 || $time > 300) + if($time < 15 || $time > 300) return; - $pid = pcntl_fork(); - - if($pid != -1) + if(function_exists("pcntl_fork")) { - if($pid) - { - return $pid; - } - else + $pid = pcntl_fork(); + + if($pid != -1) { - while(!defined("PTS_TESTING_DONE") && !defined("PTS_END_TIME") && pts_process_active("phoronix-test-suite")) + if($pid) { - eval(self::module_name() . "::" . $function . "();"); // TODO: This can be cleaned up once PHP 5.3.0+ is out there and adopted - sleep($time); + return $pid; + } + else + { + while(!defined("PTS_TESTING_DONE") && !defined("PTS_END_TIME") && pts_process_active("phoronix-test-suite")) + { + eval(self::module_name() . "::" . $function . "();"); // TODO: This can be cleaned up once PHP 5.3.0+ is out there and adopted + sleep($time); + } + exit(0); } - exit(0); } } + else + echo pts_string_header("NOTICE: php-pcntl must be installed for the " . self::module_name() . " module."); } private static function module_name() { |