Skip to content

Releases: pmmp/ext-pmmpthread

5.0.1

21 Jan 15:39
e195aef
Compare
Choose a tag to compare

Changes since 5.0.0

  • Fixed crashes involving Thread::getCurrentThread() (incorrect native return type).

5.0.0

20 Jan 16:20
2a9ae59
Compare
Choose a tag to compare

This is a major release, featuring an API revamp, removal of various magic behaviours, and generally just making the API a bit less unpleasant to use.

The overall system architecture remains the same, so migrating from previous versions of pthreads shouldn't be too arduous.

Changes since 4.x

Behaviour

  • Removed implicit array to Volatile coercion.
  • Non-thread-safe values (objects, resources) are no longer automatically serialized when assigned to thread-safe objects. This magical behaviour produced bogus expectations. The onus of serializing is now on user code.
  • Fixed private property shadowing when a thread-safe class extends another thread-safe class. Previously, private properties with the same name in different classes would overwrite each other.
  • Property types are now verified on write for defined properties.

API

  • Removed Threaded. The functionality of Threaded is now split between several classes:
    • ThreadedBase (abstract) is a basic thread-safe object (wait(), notify(), notifyOne() and synchronized()). In most cases, extends Threaded should be directly replaced with extends ThreadedBase.
    • ThreadedArray (final) extends ThreadedBase and offers array-like behaviour (shift(), pop(), merge(), chunk(), count(), fromArray())
    • ThreadedRunnable (abstract) extends ThreadedBase (run(), isRunning() and isTerminated())
    • Thread now extends ThreadedRunnable
  • Thread is now abstract.
  • Removed ThreadedSocket. Since PHP 8.0 and pthreads 4.0.0, native \Socket objects can be shared between threads safely, so this class is no longer useful (it also significantly increased the maintenance burden of pthreads)
  • Removed Volatile. All ThreadedBase descendents now support mutable operations involving other ThreadedBase objects without performance impact, so Volatile is now redundant.
  • Removed Collectable. This interface has been pointless for a while.
  • Manual refcounting APIs addRef(), delRef(), getRefCount() are removed.
  • Removed Threaded::extend(). This function made no sense and also violated class immutability when OPcache was used.
  • ArrayAccess is now able to be implemented by ThreadedBase objects. Previously, this did not work on Threaded descendents.

Internals

  • All thread-safe objects now support full mutability operations as in pthreads v2, but without the performance impact previously associated with Volatile. This is facilitated by a modification counter on the shared thread-safe object storage, allowing a low-cost way to check if syncing is necessary.
  • Improved performance and memory usage of thread-safe objects by reducing indirections, direct use of zval where appropriate, reduced copying, and more.
  • Modernized parameter parsing using fast ZPP, which improves performance when calling any methods.
  • All methods now have full parameter and return type info.
  • Thread-safe local property tables are now only built when they are needed to be accessed, which improves performance and reduces memory usage.

4.2.0

19 Jan 23:59
b410e99
Compare
Choose a tag to compare

Changes since 4.1.4

  • Preliminary support for PHP 8.2
  • Fixed memory leak when copying closures with OPcache stored parts

4.1.4

12 Oct 15:56
dc5b44a
Compare
Choose a tag to compare

Changes since 4.1.3

  • Fixed crashes in Threaded::chunk(), Threaded::shift() and Threaded::pop() (caused by improper memory leak fix in e3e05d9).
  • Fixed crashes in foreach on Threaded objects (caused by improper memory leak fix in e3e05d9).
  • Fixed segfaults, assert failures and other crashes in Threaded::chunk() and var_dump(Threaded) due to Threaded shared keys being used in non-shared arrays (refcount races).

4.1.3

22 Aug 00:43
32d0eb6
Compare
Choose a tag to compare

Changes since 4.1.2

  • Fixed false-positive type assignment errors on Threaded classes copied from other threads when OPcache is used. This happened because immutable classes' dependencies were not present in the created thread's EG(class_table).

4.1.2

20 Aug 17:00
c83526d
Compare
Choose a tag to compare

Changes since 4.1.1

  • Fixed CE_CACHE leaking onto other threads. This issue affected only non-OPcache users. Unfortunately, the fix means that memory usage without OPcache is now higher than before, since request-local interned strings can no longer be safely shared.

4.1.1

20 Aug 15:03
2ff0d2e
Compare
Choose a tag to compare

Changes since 4.1.0

  • Fixed memory leaks of string keys in Threaded::shift(), Threaded::chunk() and Threaded::pop().
  • Fixed memory leaks of string keys during foreach over Threaded objects.
  • Fixed missing reflection info for shadowed private properties.

4.1.0

28 Jul 16:00
c34df60
Compare
Choose a tag to compare

Changes since 4.0.0

  • Preliminary PHP 8.1 support (inheriting object constants is not currently supported, although enums work correctly - anything autoloaded will however work fine)
  • Dropped support for PHP 7.4
  • Fixed AST copying
  • Fixed possible crash in inherited builtin functions in user classes extending builtin classes due to scope not being updated

This is not an official release of pthreads. This repository is a fork of krakjoe/pthreads, which has been abandoned.
Its use case is primarily PocketMine-MP; while its API currently remains more or less the same as original pthreads, this may change without warning.

4.0.0

01 Nov 19:57
2547e40
Compare
Choose a tag to compare

Changes since 3.2.0

  • PHP 7.4 and 8.0 support
  • Dropped support for PHP 7.3 and below
  • Socket has been renamed to ThreadedSocket to avoid conflicting with PHP 8's new Socket class
  • Added Threaded->getIterator()
  • Many bug fixes, memory usage improvements, and performance improvements

This is not an official release of pthreads. This repository is a fork of krakjoe/pthreads, which has been abandoned.
Its use case is primarily PocketMine-MP; while its API currently remains more or less the same as original pthreads, this may change without warning.