Skip to content

Instantly share code, notes, and snippets.

@fjugaldev
Created April 14, 2020 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fjugaldev/443d1dbfb2528e8b2e586fa179be67cc to your computer and use it in GitHub Desktop.
Save fjugaldev/443d1dbfb2528e8b2e586fa179be67cc to your computer and use it in GitHub Desktop.
<?php
require_once "Threading/ThreadManager.php";
require_once "Threading/Task/BaseTask.php";
require_once "Threading/Task/Task.php";
$maxThreads = 5;
$pushNotifications = 30;
echo 'Ejemplo de forking de procesos con PHP con un máximo de ' . $maxThreads . ' hilos' . PHP_EOL . PHP_EOL;
$exampleTask = new Threading\Task\Task();
$multithreadManager = new Threading\ThreadManager();
$cpt = 0;
while (++$cpt <= $pushNotifications)
{
$multithreadManager->start($exampleTask);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment