2
我在php中使用PThreads进行多线程。我已经在Windows上的XAMPP服务器上成功安装并运行了它。 我有100K记录在我的数据库,我想运行parallel.Every螺纹20个线程将调用来自数据库和流程5K记录them.Here是我这个PHP的Pthread问题
require('mailscript.php');
class My extends Thread{
function __construct() {
$this->mailscript = new mailscript();
}
function run(){
$this->mailscript->runMailScript(5000);
}
}
for($i=0;$i<20;$i++){
$pool[] = new My();
}
foreach($pool as $worker){
$worker->start();
}
foreach($pool as $worker){
$worker->join();
}
代码时,我只运行此代码它每个线程最多运行约600条记录。对于PThread中的线程数有任何限制问题。有什么问题请帮助我