centraldesktop/parallel
Composer 安装命令:
composer require centraldesktop/parallel
包简介
Easily allows forking up to a max number of processes
README 文档
README
An easy to use and simple library for doing parallel processing using simple process forks.
All credit should go to the amazing maintainers of Perl's (CPAN) Parallel::ForkManager which I used for about 10 years.
To use:
Add this package to your composer dependencies.
use CentralDesktop\Parallel\ForkManager;
// build an object, limit to total concurrent processes.
You must declare(ticks = 1); in order for signal handing to work properly in PHP
$fm = new ForkManager(10); $fm->start();
while ($fm->alive()) { if ($fm->start()) { continue; }
do_something();
$fm->stop(); } $fm->shutdown_all();
You probably may want to handle specific signals by installing signal handlers.
$fm->set_parent_sighandler(array($this, 'parent_signal_handler'));
$fm->set_child_sighandler(array($this, 'child_signal_handler'));
统计信息
- 总下载量: 20.96k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2013-04-19