PHP Classes

File: example/WithMoreTasksThenOpenThreads/run

Recommend this page to a friend!
  Classes of nvb  >  Process Fork Manager for PHP  >  example/WithMoreTasksThenOpenThreads/run  >  Download  
File: example/WithMoreTasksThenOpenThreads/run
Role: Example script
Content type: text/plain
Description: Example script
Class: Process Fork Manager for PHP
Run parallel processes and manage their execution
Author: By
Last change:
Date: 5 years ago
Size: 626 bytes
 

Contents

Class file image Download
#!/usr/bin/env php
<?php
/**
 * @author stev leibelt <artodeto@bazzline.net>
 * @since 2014-07-21
 */

namespace Net\Bazzline\Component\ProcessForkManager\Example\WithMoreTasksThenOpenThreads;

require_once
__DIR__ . '/../bootstrap.php';
require_once
'ExampleTask.php';

use
Net\Bazzline\Component\ProcessForkManager\ForkManagerFactory;

$factory = new ForkManagerFactory();
$manager = $factory->create();

$manager->setMaximumNumberOfThreads(4);
$totalNumberOfTasks = 7;

for (
$iterator = 0; $iterator < $totalNumberOfTasks; ++$iterator) {
   
$task = new ExampleTask();
   
$manager->addTask($task);
}

$manager->execute();

For more information send a message to info at phpclasses dot org.