简介

pht is a new threading extension for PHP. It enables for classes, functions, and even entire files to be threaded. Currently, pht can only be used with PHP 7.2. This is due to ZTS mode being unsafe in PHP 7.0 and 7.1. Support for PHP >7.2 is coming soon.

Warning

The pht extension should not be used in a web server environment. Threading should be restricted to CLI-based applications only.

The approach to threading that pht takes is to abstract away the thread itself behind a dedicated object (pht\Thread). Tasks are then added to the thread's internal task queue, where they are processed when the thread is started (via

All thread tasks will execute in isolation inside of the newly spawned thread. For class tasks, this means the spawned objects cannot be passed around between threads. By keeping the threading contexts completely separate from one-another, there becomes no need to serialise the properties of threaded objects (which is a necessary evil if such objects have to operate in multiple threads).

The isolation of threading contexts makes the passing around of data between them somewhat problematic. To solve this problem, threadable data structures (pht\HashTable, pht\Vector, and pht\Queue) have been implemented to allow for a two-way communication style between threads, where they expose mutex locks to control their integrity. These data structures can be safely passed around between threads, and manipulated by multiple threads using the mutex locks that have been packed in with them. They are reference-counted across threads, and so they do not need to be explicitly destroyed. This approach to threading means that only the given built-in data structures need to be safely passed around between threads.

Atomic values are also supported by pht. Currently, only an pht\AtomicInteger class exists. Like the threaded data structures, it too can safely be passed around between threads.

pht43 php13,PHP pht 简介_编程学问网相关推荐

  1. sqlite+php+函数大全,PHP SQLite SQLite 函数_编程学问网

    sqlite_array_query - Execute a query against a given database and returns an array sqlite_busy_timeo ...

  2. mysql创建数据库时候同时创建表空间_MySQL 创建InnoDB表空间_编程学问网

    15.2.5. 创建InnoDB表空间 假设你已经安装了MySQL,并且已经编辑了选项文件,使得它包含必要的InnoDB配置参数.在启动MySQL之前,你应该验证你为InnoDB数据文件和日志文件指定 ...

  3. mysql blackhole缺点_MySQL BLACKHOLE存储引擎_编程学问网

    15.10.BLACKHOLE存储引擎 BLACKHOLE存储引擎就像"黑洞"一样,它接收数据但丢弃它而不是存储它.取回总是返回空集: mysql> CREATE TABLE ...

  4. php zip 归档使用工具,PHP 压缩与归档扩展 Zip_编程学问网

    ZipArchive::addFile - Adds a file to a ZIP archive from the given path ZipArchive::addFromString - A ...

  5. 同济大学计算机科学与技术系,同济大学计算机科学与技术系简介_跨考网

    同济大学计算机科学与技术工程系成立于一九八七年九月,其前身源于我校电气工程系的计算机教研室. 随着全国教育体制改革的不断发展,一九九六年九月原上海城市建设学院和原上海建材学院并入同济大学,与之相应的城 ...

  6. mysql read rnd next_MySQL rnd_next_编程学问网

    16.14.11. rnd_next 目的 从表中读取下一行,并将其返回服务器. 概要 virtual int rnd_next ( buf); byte * buf ; 描述 这是rnd_next方 ...

  7. mysql安装connector选项_MySQL 安装 Connector/J_编程学问网

    MySQL Connector/J是以.zip或.tar.gz形式分发的,其中包含源码.类文件.以及仅为"二进制".jar的类文件(名为 mysql-connector-java- ...

  8. java程序设计专业介绍_简介Java编程中的Object类

    这篇文章主要介绍了简介Java编程中的Object类,是Java入门学习中的基础知识,需要的朋友可以参考下 Object 类位于 java.lang 包中,是所有 Java 类的祖先,Java 中的每 ...

  9. PowerPC简介及编程

    PowerPC简介及编程 一,PowerPC芯片 PowerPC是早期Motorola和IBM联合为Apple的MAC机开发的CPU芯片,商标权同时属于IBM和Motorola,并成为他们的主导成品. ...

最新文章

  1. 关于自动驾驶汽车法律政策的十点思考
  2. 解放程序员双手!GPT-3自动生成SQL语句 | 代码开源
  3. 边缘计算 — MEC 与运营商
  4. python要自学多长时间-怎么自学python,大概要多久?
  5. spray.json.JsonParser$ParsingException: Unexpected end-of-input at input index
  6. 为什么建议你使用枚举?
  7. 10天确定Python,运行环境(超详细步骤)
  8. Java分布式唯一ID生成方案——比UUID效率更高的生成id工具类
  9. 【Python】【Python库】Python3.7.2 - 字符串str类 (1)
  10. MySQL反斜杠 ‘\\‘ 插入数据库丢失
  11. 痞子衡嵌入式:如果你正在量产i.MX RT产品,不妨试试这款神器RT-Flash
  12. EP100触发CAN中断但无法读取报文
  13. HDU 6405 Make ZYB Happy
  14. 日志平台-统一日志平台ELK管理
  15. 2019年双十一购物数据分析报告
  16. Coursera | Andrew Ng (01-week-2-2.5)—导数
  17. VLookup函数详细教程
  18. 电热水器排污口镁棒掉入内胆怎么办?
  19. 关于 Python PyQt5 界面运行时提示无法初始化Qt平台的解决方案
  20. SATA学习笔记 3 --- SATA简介

热门文章

  1. linux安装elasticsearch服务
  2. Ubuntu18保姆级教程及其jdk和hadoop安装含资源
  3. 一文带你看透二维码生成器
  4. tensorflow笔记(曹健老师):mnist数据集手写数字识别
  5. oracle drop column 多个,3000W记录,alter table drop column很慢
  6. 手写Spring-第十二章-Engage!将AOP和Spring生命周期结合起来
  7. ClickHouse 安装
  8. Matlab 2019b simulink 生成C代码(二)用fixed point tool 生成定点代码
  9. 乡村振兴——VR全景助力农业新体验,让乡村更振兴
  10. pdf文件转jpg转换器