(PECL pthreads >= 2.0.0)
Worker::getStacked — 获取剩余的堆栈大小
此函数没有参数。
返回当前等待工作进程执行的任务数量
示例 #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