bugdhdj / pthwools
A polyfill for pthreads
Requires
- php: ^7.4 | ^8.0
- ext-swoole: ^4.0
Requires (Dev)
- eaglewu/swoole-ide-helper: dev-master
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2025-02-26 21:36:47 UTC
README
pthwools aims to satisfy the API requirements of pthreads with swoole, such that code written to depend on pthreads will work when pthreads is not, or can not be loaded.
pthwools does not implement the same execution model, for obvious reasons, but uses swoole coroutine to implement asynchronous code execution and multi-core optimization.
pthwools will ONLY fill for v3, behaviour is consistent with v3, which is the version new projects should target.
It is used in bugdhdj/PocketMine-MP-Swoole Project.
Testing
pthwools is distributed with some unit tests, these tests should pass with and without pthreads loaded.
Testing pthwools
phpunit tests
If pthreads is loaded by your configuration the pthwools will not be used.
Testing code coverage for pthwools
phpdbg -nqrr vendor/bin/phpunit tests --coverage-text