【文件属性】:
文件名称:PHP的线程库pthreads.zip
文件大小:187KB
文件格式:ZIP
更新时间:2022-08-04 22:42:54
开源项目
该项目为 PHP 提供基于 POSIX 的多线程编程机制。可异步执行任何与定义的用户自定义方法和函数。内建支持同步和同步方法。
要求:
PHP5.3
ZTS Enabled ( Thread Safety )
Posix Threads Implementation
示例代码:
<?php
class AsyncOperation extends Thread {
public function __construct($arg){
$this->arg = $arg;
}
public function run(){
if($this->arg){
printf("Hello %s\n", $this->arg);
}
}
}
$thread = new AsyncOperation("World");
if($thread->start())
$thread->join();
?>
标签:pthreads