(PECL pthreads >= 2.0.0)
Worker::getStacked — 獲取剩余的棧大小
返回棧中剩余的任務(wù)數(shù)量
此函數(shù)沒有參數(shù)。
返回 worker 中等待執(zhí)行的任務(wù)數(shù)量
示例 #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";
以上例程會(huì)輸出:
There are 5 stacked tasks