Created
April 14, 2020 08:21
-
-
Save fjugaldev/443d1dbfb2528e8b2e586fa179be67cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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