本文整理汇总了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());