(PECL pthreads >= 2.0.0)
Worker::getStacked — 获取剩余的栈大小
此函数没有参数。
返回 worker 中等待执行的任务数量
示例 #1 Worker::getStacked 基本示例
<?php
$worker = new Worker();
for ($i = 0; $i < 5; ++$i) {
$worker->stack(new class extends Threaded {});
}
echo "There are {$worker->getStacked()} stacked tasks\n";
以上示例会输出:
There are 5 stacked tasks