workerman原理

phperv5
    public function __construct()
    {
        // 创建一个管道,放入监听读的描述符集合中,避免空轮询
        $this->channel = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);
        if($this->channel)
        {
            stream_set_blocking($this->channel, 0);
            $this->_readFds = $this->channel;
        }
        // 初始化优先队列(最大堆)
        $this->_scheduler = new \SplPriorityQueue();
        $this->_scheduler->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
    }

这个管道是干嘛的,是开辟一个共享内存么?

5251 1 0
1个回答

walkor

创建一个管道,放入监听读的描述符集合(数组)中,避免传给stream_select空的数组

  • 暂无评论
年代过于久远,无法发表回答
🔝