Skip to content

webmaniacs-net/lib-fork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lib-fork

Install the latest version with composer require webmaniacs.net/lib-fork

Examples

$manager = new \wmlib\fork\Manager(function(array $error) {
    print_r($error);
    die('Child process error');
});
$manager->setNotifier($notifier = new \wmlib\fork\Notifier\Shm());

$manager->child(function (\wmlib\fork\INotifier $notifier, $var) {
    echo 'Start '.getmypid()."\n";
    echo 'Echo from child process with '.$var.' value!';
    sleep(1);
    echo 'End '.getmypid()."\n";
}, ['var' => 'value']);

while($manager->loop(10)) {
    // run 10 forked childs in infinite loop
    // Manager will handle childs count
    usleep(10000);
}
echo "End\n";

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages