php pthread中文文档,PHP的线程库:pthreads

该项目为 PHP 提供基于 POSIX 的多线程编程机制。可异步执行任何与定义的用户自定义方法和函数。内建支持同步和同步方法。

亮点

一个易于使用,快速学习的 Threading API for PHP5.3+

Execute any and all predefined and user declared methods and functions asynchronously

Ready made synchronization included, geared towards the PHP environment

Seamless operation in multi-threaded SAPI environments

A world of possibilities ...

技术特性

Posix Threads

Synchronization

Worker Threads

Synchronized Methods

Complete Support for OO - ie. traits, interfaces, inheritance

Full read/write/execute support for threaded objects

Mutex ( direct, subset )

Conditions ( direct, subset )

pthreads was written with simplicity, compatibility and efficiency in mind, it's performance beggars belief !!

环境要求

PHP5.3+

ZTS Enabled ( Thread Safety )

Posix Threads Implementation

Testing has been carried out on x86, x64 and ARM, in general you just need a compiler and pthread.h

PHP 版本支持

pthreads should compile and work in any version of PHP from 5.3.0 to the latest release.

示例代码:

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();

?>复制代码

项目主页:http://www.open-open.com/lib/view/home/1391824675848

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值