src/MQK/Process/MasterProcess.php
public function run()
    {
        $this->createdAt = time();
        $pid = getmypid();
        $this->logger->debug("master process id is {$pid}");
        $this->spawn();

        $this->pipe = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);

        stream_set_blocking($this->pipe[0], true);
        stream_set_blocking($this->pipe[1], true);

        foreach (array_keys($this->signalMappingToMethod) as $signal)
            pcntl_signal($signal, array(&$this, "signalHandle"));

        $watchFileDescriptors = $this->fileDescriptors;
        $watchFileDescriptors[] = $this->pipe[1];
        while (true) {
            $r = $watchFileDescriptors;
            $w = [];
            $e = [];

            try {
                $this->willSelect();
                $this->select($r, $w, $e, $this->selectTimeout);
                $this->didSelect();
            } catch (\Exception $e) {
                $this->logger->error($e->getMessage());
                $this->dispatch_signals();
            }
        }
    }
public function run()
    {
        $this->createdAt = time();
        $pid = getmypid();
        $this->logger->debug("master process id is {$pid}");
        $this->spawn();

        $this->pipe = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);

        stream_set_blocking($this->pipe[0], true);
        stream_set_blocking($this->pipe[1], true);

        foreach (array_keys($this->signalMappingToMethod) as $signal)
            pcntl_signal($signal, array(&$this, "signalHandle"));

        $watchFileDescriptors = $this->fileDescriptors;
        $watchFileDescriptors[] = $this->pipe[1];
        while (true) {
            $r = $watchFileDescriptors;
            $w = [];
            $e = [];

            try {
                $this->willSelect();
                $this->select($r, $w, $e, $this->selectTimeout);
                $this->didSelect();
            } catch (\Exception $e) {
                $this->logger->error($e->getMessage());
                $this->dispatch_signals();
            }
        }
    }
开始启动主进程

@return void