该项目为 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

php pthread nts,PHP的线程库:pthreads相关推荐

  1. Linux系统编程36:多线程之线程控制之pthread线程库(线程创建,终止,等待和分离)

    文章目录 (1)POSIX线程库 (2)pthread_create--创建线程 A:关于Linux线程的再理解 B:线程ID及地址空间布局 (3)pthread_exit--线程终止 (4)pthr ...

  2. pthread线程库使用介绍

    多线程的开发和应用在平时的项目中使用非常频繁.Linux C++中,一般使用pthread库操作线程相关业务,不少公司一般都会基于该线程库的基本接口进行封装,使用起来更加方便易用.本文对该线程库的常用 ...

  3. Linux系统编程----15(线程与进程函数之间的对比,线程属性及其函数,线程属性控制流程,线程使用注意事项,线程库)

    对比 进程 线程 fork pthread_create exit (10) pthread_exit (void *) wait (int *) pthread_join (,void **)阻塞 ...

  4. linux 线程库在哪里,linux线程库

    简单地讲,进程是资源管理的最小单位,线程是程序执行的最小单位.一个进程至少要一个线程作为它的指令执行体,进程管理着资源(比如CPU,内存,文件等),而将线程分配到某个CPU上执行.一个进程当然可以拥有 ...

  5. C++11学习笔记-----线程库std::thread

    在以前,要想在C++程序中使用线程,需要调用操作系统提供的线程库,比如linux下的<pthread.h>.但毕竟是底层的C函数库,没有什么抽象封装可言,仅仅透露着一种简单,暴力美 C++ ...

  6. State Threads 回调终结者(ST线程库)

    本文转自: http://coolshell.cn/articles/12012.html 上回写了篇<一个"蝇量级"C语言协程库>,推荐了一下Protothreads ...

  7. linux thread model . Linux上posix线程库实现原理讨论

    http://blog.csdn.net/fanbird2008/article/details/6752853 Linux上posix线程库实现原理讨论 说明一下,这个问题困扰我好长时间,因为正如使 ...

  8. 在Ubuntu 14.04 64bit上编译并研究State Threads网络线程库源码

    State Threads是一个广受关注的高性能网络线程库,winlin在SRS中做了比较充分的应用,我很遗憾直到现在才精心研究它.下面是我的研究实录,以作备忘. 一.源码编译 下面是在Ubuntu ...

  9. C++中的lambda表达式和线程库

    98中的一个例子 如果想要对一个数据集合中的元素进行排序,可以使用std::sort方法 #include <algorithm> #include <functional> ...

最新文章

  1. C#中数组、ArrayList和List三者的区别
  2. pycharm python3区别_1.安装Python3和PyCharm
  3. linux中ssh连接慢的一种解决方法
  4. 几个实用的Servlet应用例子-入门、cookie、session及上传文件
  5. Struts2 Servelet重构
  6. python接口自动化(二十八)--html测试 报告——下(详解)
  7. Eclipse中设置自动生成的author,date等注释
  8. 201612-2 工资计算
  9. 何时使用 Golang
  10. 洛谷——P4053 [JSOI2007]建筑抢修
  11. html 加粗_一篇文章带你了解HTML格式化元素
  12. [入门] Delphi XE2 的控件安装方法。
  13. orm框架有哪些_.net core 基于Dapper 的分库分表开源框架(coredata)
  14. 用QT制作一个抽奖器的总结
  15. 如何安装固态硬盘和重装系统???
  16. FPGA入门之一位全加器的实现
  17. 北航计算机专业报录比,北京航空航天大学考研报录比数据查询
  18. Ubuntu 20.04 快速搭建Vue开发环境
  19. BOS启动的客户端,打开序时簿只显示一行
  20. 字母c代表什么数字_字母C

热门文章

  1. 力扣——883. 三维形体投影面积(Java、JavaScript、C实现)
  2. python scrapy 爬取包含iframe标签内的数据
  3. HTML文本、段落标记
  4. AVPlayer实现视频播放
  5. AMBA 系列之 AXI 总线协议
  6. 2-1输入两个整数num1和num2,计算并输出他们的和、差、积、商与余数
  7. 淮阴中学2021高考成绩查询,2021年淮阴高考成绩排名及成绩公布时间什么时候出来...
  8. 出现ERROR The server quit without updating PID file
  9. 已声明“XXX”,但从未读取其值,vscode 如何关闭ts报错
  10. 计算机那些事——图形图像渲染原理