本文整理匯總了PHP中swoole_process::statQueue方法的典型用法代碼示例。如果您正苦於以下問題:PHP swoole_process::statQueue方法的具體用法?PHP swoole_process::statQueue怎麽用?PHP swoole_process::statQueue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類swoole_process
的用法示例。
在下文中一共展示了swoole_process::statQueue方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: callback_function
<?php
function callback_function(swoole_process $worker)
{
//echo "Worker: start. PID=".$worker->pid."\n";
//recv data from master
while (true) {
$recv = $worker->pop();
echo "From Master: {$recv}\n";
}
sleep(2);
$worker->exit(0);
}
$process = new swoole_process('callback_function', false, false);
$process->useQueue();
$bytes = 0;
foreach (range(1, 10) as $i) {
$data = "hello worker[{$i}]\n";
$bytes += strlen($data);
$process->push($data);
}
echo "bytes={$bytes}\n";
var_dump($process->statQueue());