can call a static class

This commit is contained in:
ZsBT 2015-04-10 09:58:03 +02:00
parent 50f1156b08
commit 39e2888801
1 changed files with 10 additions and 6 deletions

View File

@ -9,18 +9,22 @@ require_once("ThreadQueue.php");
// it is the function that will be called several times
// function is a static method of a class
abstract class class1 {
static function parallel_task($arg){
echo "task with parameter '$arg' starts\n";
sleep( rand(2,5) ); // wait for random seconds
echo "task with parameter '$arg' ENDS\n";
}
function parallel_task($arg){
echo "task with parameter '$arg' starts\n";
sleep( rand(2,5) ); // wait for random seconds
echo "task with parameter '$arg' ENDS\n";
}
// we want 3 jobs in parallel instead of the default 2
$TQ = new ThreadQueue("parallel_task", 3);
$TQ = new ThreadQueue("class1::parallel_task", 3);
// add tasks