我在那里有一颗 cometd 我以这种方式运行一个 while 循环
$items = $statement->fetchAll();//statement is a PDO Statement
$iteration = 0;
while(count($items) == 0 && $iteration < 100){
$items = $statement->fetchAll();
usleep(10000);
++$iteration;
}
当 Comet 运行时,我可以看到所有其他 HTTP 请求都处于挂起状态。即使是非数据库请求也是挂起的。为什么?
最佳答案
关于PHP comet usleep 阻塞 apache mpm?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11126465/