function run() { $default = TasksHolder::$tasks['default']; $scheduler = new Scheduler(); $scheduler->newTask($default); $scheduler->run(); }
{ for ($i = 1; $i < $max; ++$i) { echo "{$msg} iteration {$i}\n"; yield; } } function taskTest() { $x = echoTimes('foo', 10); $x->send("dd"); $x->send("dd"); $x->send("dd"); echo "----\n"; echoTimes('bar', 5); yield; } function taskerror() { try { (yield killTask(500)); } catch (Exception $e) { echo "try to kill task failed", $e->getMessage(), "\n"; } } $scheduler = new Scheduler(); //$scheduler->newTask(taskTest()); $scheduler->newTask(server(8010)); $scheduler->newTask(server(8011)); $scheduler->newTask(server(8012)); $scheduler->run(); //server(8002);