<?php
/**
 * Created by PhpStorm.
 * User: 27394
 * Date: 2017/4/18
 * Time: 8:50
 */
// Worker 线程:非指定,不自动结束
class Test extends Threaded{
    // TODO
}
$worker = new Worker();
echo "当前任务栈中包含 {$worker->collect()}任务\n";
for ($i = 0; $i < 3; ++$i) {
    $worker->stack(new Test());
}
echo "当前任务栈中包含 {$worker->collect()}任务\n";
$worker->start();
while ($worker->collect());// 阻塞直到线程结束
echo "当前任务栈中包含 {$worker->collect()}任务\n";
$worker->shutdown();`这里写代码片`