<commit_before><commit_msg>add Master<commit_after><?php
/**
 * @author Jenner <<EMAIL>>
 * @license https://opensource.org/licenses/MIT MIT
 * @datetime: 2015/11/13 16:37
 */

namespace React\Multi;


use Jenner\SimpleFork\FixedPool;
use React\EventLoop\LoopInterface;

class Master
{
    /**
     * @var LoopInterface
     */
    protected $loop;

    /**
     * @var int process count
     */
    protected $count;

    /**
     * @param LoopInterface $loop
     * @param int $count
     */
    public function __construct(LoopInterface $loop, $count = 10)
    {
        $this->loop = $loop;
        $this->count = $count;
    }

    /**
     * start multi loop
     */
    public function start()
    {
        $loop = $this->loop;
        $pool = new FixedPool(function () use ($loop) {
            $loop->run();
        }, $this->count);

        $pool->start();
        $pool->keep(true);
    }
}
{'fraction_non_alphanumeric': 0.15725359911406422, 'fraction_numerical': 0.015503875968992248, 'mean_word_length': 2.054054054054054, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 12, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4960508', 'n_tokens_mistral': 303, 'n_tokens_neox': 284, 'n_words': 62}