muduo_net库源码分析


  • Channel是selectable IO channel,负责注册与响应IO 事件,它不拥有file descriptor。

  • Channel是Acceptor、Connector、EventLoop、TimerQueue、TcpConnection的成员,生命期由后者控制。




时序图








EventLoop头文件

eventloop.h

<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 743.4000244140625px; overflow: auto; padding-top: 1px; margin: 18px 0px !important; "><div class="bar" style="padding-left: 45px; "><div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(153, 153, 153); "><strong>[cpp]</strong> <a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="ViewSource" title="view plain" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">view plain</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="CopyToClipboard" title="copy" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">copy</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="PrintSource" title="print" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">print</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="About" title="?" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">?</a><div style="position: absolute; left: 402px; top: 1877px; width: 24px; height: 12px; z-index: 99; "><embed id="ZeroClipboardMovie_1" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="24" height="12" name="ZeroClipboardMovie_1" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=1&width=24&height=12" wmode="transparent" /></div></div></div><ol start="1" class="dp-cpp" style="margin: 0px 0px 1px 45px !important; padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); "><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Copyright 2010, Shuo Chen.  All rights reserved.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// http://code.google.com/p/muduo/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Use of this source code is governed by a BSD-style license</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// that can be found in the License file.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Author: Shuo Chen (chenshuo at chenshuo dot com)</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// This is a public header file, it must only include public header files.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#ifndef MUDUO_NET_EVENTLOOP_H</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#define MUDUO_NET_EVENTLOOP_H</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <vector></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <boost/noncopyable.hpp></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <boost/scoped_ptr.hpp></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/base/CurrentThread.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/base/Thread.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/base/Timestamp.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> muduo  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> net  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">class</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Channel; </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//聚合</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">class</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Poller; </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//组合</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// Reactor, at most one per thread.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// This is an interface class, so don't expose too much details.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">class</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> EventLoop : boost::noncopyable  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "> <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">public</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">:  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  EventLoop();  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  ~EventLoop();  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// force out-line dtor, for scoped_ptr members.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// Loops forever.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// Must be called in the same thread as creation of the object.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> loop();  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> quit();  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// Time when poll returns, usually means data arrivial.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  Timestamp pollReturnTime() <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> { </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> pollReturnTime_; }  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// internal usage</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> updateChannel(Channel* channel);     </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 在Poller中添加(注册)或者更新通道</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> removeChannel(Channel* channel);     </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 从Poller中移除通道</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*断言是否在Loop 线程中*/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> assertInLoopThread()  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//如果不是在LoopThread中,终止程序</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (!isInLoopThread())  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      abortNotInLoopThread();  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//判断是在当前线程是否在LoopThread中</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">bool</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> isInLoopThread() </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> { </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> threadId_ == CurrentThread::tid(); }  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">static</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> EventLoop* getEventLoopOfCurrentThread();  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "> <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">private</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">:  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> abortNotInLoopThread();  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> printActiveChannels() </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">; </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// DEBUG</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">typedef</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> std::vector<Channel*> ChannelList;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">bool</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> looping_; </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*是否处于循环状态 atomic */</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">bool</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> quit_; </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*是否退出Loop atomic */</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">bool</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> eventHandling_; </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*当前是否处于事件处理的状态 atomic */</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> pid_t threadId_;        </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 当前对象所属线程ID</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  Timestamp pollReturnTime_;    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//调用poller时候的返回时间</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  boost::scoped_ptr<Poller> poller_; <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//poller对象,生命周期由EventLoop控制</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  ChannelList activeChannels_;  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Poller返回的活动通道 ,</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">                                <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//就是活动状态的socket///typedef std::vector<Channel*> ChannelList;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  Channel* currentActiveChannel_;   <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 当前正在处理的活动通道</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">};  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#endif  // MUDUO_NET_EVENTLOOP_H</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li></ol></div>

EventLoop源文件

EventLoop.cc


<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 743.4000244140625px; overflow: auto; padding-top: 1px; margin: 18px 0px !important; "><div class="bar" style="padding-left: 45px; "><div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(153, 153, 153); "><strong>[cpp]</strong> <a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="ViewSource" title="view plain" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">view plain</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="CopyToClipboard" title="copy" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">copy</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="PrintSource" title="print" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">print</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="About" title="?" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">?</a><div style="position: absolute; left: 402px; top: 3675px; width: 24px; height: 12px; z-index: 99; "><embed id="ZeroClipboardMovie_2" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="24" height="12" name="ZeroClipboardMovie_2" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=2&width=24&height=12" wmode="transparent" /></div></div></div><ol start="1" class="dp-cpp" style="margin: 0px 0px 1px 45px !important; padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); "><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Copyright 2010, Shuo Chen.  All rights reserved.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// http://code.google.com/p/muduo/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Use of this source code is governed by a BSD-style license</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// that can be found in the License file.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Author: Shuo Chen (chenshuo at chenshuo dot com)</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/net/EventLoop.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/base/Logging.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/net/Channel.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/net/Poller.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//#include <poll.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">using</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> muduo;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">using</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> muduo::net;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 当前线程EventLoop对象指针</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 线程局部存储</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">__thread EventLoop* t_loopInThisThread = 0;  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> kPollTimeMs = 10000;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">EventLoop* EventLoop::getEventLoopOfCurrentThread()  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> t_loopInThisThread;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*</span> </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">事件循环,该函数不能夸线程调用</span> </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">只能在创建该对象的线程中调用</span> </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">**/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">EventLoop::EventLoop()  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  : looping_(<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">false</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">),  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    quit_(<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">false</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">),  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    eventHandling_(<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">false</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">),  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    threadId_(CurrentThread::tid()),  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    poller_(Poller::newDefaultPoller(<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">this</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">)),  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    currentActiveChannel_(NULL)  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  LOG_TRACE << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"EventLoop created "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">this</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << </span><span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">" in thread "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << threadId_;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 如果当前线程已经创建了EventLoop对象,终止(LOG_FATAL)</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (t_loopInThisThread)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    LOG_FATAL << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"Another EventLoop "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << t_loopInThisThread  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">              << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">" exists in this thread "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << threadId_;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//如果当前线程没有创建EventLoop对象,则创建EventLoop对象,并且进行绑定</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">else</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    t_loopInThisThread = <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">this</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">EventLoop::~EventLoop()  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  t_loopInThisThread = NULL;  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "> <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//这是IO线程</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 事件循环,该函数不能跨线程调用</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 只能在创建该对象的线程中调用</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> EventLoop::loop()  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//断言是否处于非循环状态</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assert(!looping_);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 断言当前处于创建该对象的线程中</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assertInLoopThread();  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  looping_ = <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">true</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  LOG_TRACE << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"EventLoop "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">this</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << </span><span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">" start looping"</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//::poll(NULL, 0, 5*1000);</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//循环直到退出</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">while</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (!quit_)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//先清除活动通道</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    activeChannels_.clear();  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//调用poller_->poll返回活动的通道 &activeChannels_以及poll返回的时间</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    pollReturnTime_ = poller_->poll(kPollTimeMs, &activeChannels_);  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//++iteration_;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//输出 处于活动状态的channel 到日志中</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (Logger::logLevel() <= Logger::TRACE)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      printActiveChannels();  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// TODO sort channel by priority</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//当前事件处理状态设为true </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    eventHandling_ = <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">true</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//循环处理活动通道的事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">for</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (ChannelList::iterator it = activeChannels_.begin();  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">        it != activeChannels_.end(); ++it)  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      currentActiveChannel_ = *it;  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      currentActiveChannel_->handleEvent(pollReturnTime_);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//把当前的活动通道设为 NULL</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    currentActiveChannel_ = NULL;  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//当前事件处理状态设为false</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    eventHandling_ = <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">false</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//doPendingFunctors();</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  LOG_TRACE << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"EventLoop "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">this</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << </span><span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">" stop looping"</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  looping_ = <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">false</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "> <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//该函数可以跨线程调用,这也是防止程序</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> EventLoop::quit()  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  quit_ = <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">true</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">; </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//由于是多线程访问这个变量,那么是否需要保护这个变量??,要的。但是quit_是布尔类型,是一种对布尔类型的变量操作是一种原子操作,所以我们不用显式的进行保护了</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (!isInLoopThread())  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//wakeup();</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 用于注册或者更新 channel的事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> EventLoop::updateChannel(Channel* channel)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 断言Channel 是否属于当前的EventLoop对象</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assert(channel->ownerLoop() == <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">this</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">);  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 断言EventLoop所属的线程是当前的线程</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assertInLoopThread();  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 更新channel的事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  poller_->updateChannel(channel);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> EventLoop::removeChannel(Channel* channel)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assert(channel->ownerLoop() == <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">this</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">);  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assertInLoopThread();  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (eventHandling_)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    assert(currentActiveChannel_ == channel ||  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">        std::find(activeChannels_.begin(), activeChannels_.end(), channel) == activeChannels_.end());  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  poller_->removeChannel(channel);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//如果不是在LoopThread线程中将终止线程</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> EventLoop::abortNotInLoopThread()  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  LOG_FATAL << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"EventLoop::abortNotInLoopThread - EventLoop "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">this</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">            << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">" was created in threadId_ = "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << threadId_  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">            << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">", current thread id = "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> <<  CurrentThread::tid();  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*打印处于活动状态的channel 到日志中*/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> EventLoop::printActiveChannels() </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">for</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (ChannelList::const_iterator it = activeChannels_.begin();  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      it != activeChannels_.end(); ++it)  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Channel* ch = *it;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    LOG_TRACE << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"{"</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << ch->reventsToString() << </span><span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"} "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li></ol></div>



Poller头文件

poller.h

<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 743.4000244140625px; overflow: auto; padding-top: 1px; margin: 18px 0px !important; "><div class="bar" style="padding-left: 45px; "><div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(153, 153, 153); "><strong>[cpp]</strong> <a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="ViewSource" title="view plain" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">view plain</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="CopyToClipboard" title="copy" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">copy</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="PrintSource" title="print" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">print</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="About" title="?" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">?</a><div style="position: absolute; left: 402px; top: 6711px; width: 24px; height: 12px; z-index: 99; "><embed id="ZeroClipboardMovie_3" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="24" height="12" name="ZeroClipboardMovie_3" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=3&width=24&height=12" wmode="transparent" /></div></div></div><ol start="1" class="dp-cpp" style="margin: 0px 0px 1px 45px !important; padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); "><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Copyright 2010, Shuo Chen.  All rights reserved.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// http://code.google.com/p/muduo/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Use of this source code is governed by a BSD-style license</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// that can be found in the License file.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Author: Shuo Chen (chenshuo at chenshuo dot com)</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// This is an internal header file, you should not include this.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#ifndef MUDUO_NET_POLLER_H</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#define MUDUO_NET_POLLER_H</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <vector></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <boost/noncopyable.hpp></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/base/Timestamp.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/net/EventLoop.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> muduo  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> net  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">class</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Channel;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// Base class for IO Multiplexing</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// This class doesn't own the Channel objects.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">class</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Poller : boost::noncopyable  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "> <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">public</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">:  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">typedef</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> std::vector<Channel*> ChannelList;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  Poller(EventLoop* loop);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">virtual</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> ~Poller();  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// Polls the I/O events.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// Must be called in the loop thread.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">virtual</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Timestamp poll(</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> timeoutMs, ChannelList* activeChannels) = 0;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// Changes the interested I/O events.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// Must be called in the loop thread.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">virtual</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> updateChannel(Channel* channel) = 0;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// Remove the channel, when it destructs.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// Must be called in the loop thread.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">virtual</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> removeChannel(Channel* channel) = 0;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">static</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Poller* newDefaultPoller(EventLoop* loop);  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> assertInLoopThread()  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    ownerLoop_->assertInLoopThread();  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "> <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">private</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">:  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  EventLoop* ownerLoop_;    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Poller所属EventLoop</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">};  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#endif  // MUDUO_NET_POLLER_H</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li></ol></div>

Poller源文件

poller.cc

<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 743.4000244140625px; overflow: auto; padding-top: 1px; margin: 18px 0px !important; "><div class="bar" style="padding-left: 45px; "><div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(153, 153, 153); "><strong>[cpp]</strong> <a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="ViewSource" title="view plain" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">view plain</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="CopyToClipboard" title="copy" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">copy</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="PrintSource" title="print" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">print</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="About" title="?" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">?</a><div style="position: absolute; left: 402px; top: 7990px; width: 24px; height: 12px; z-index: 99; "><embed id="ZeroClipboardMovie_4" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="24" height="12" name="ZeroClipboardMovie_4" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=4&width=24&height=12" wmode="transparent" /></div></div></div><ol start="1" class="dp-cpp" style="margin: 0px 0px 1px 45px !important; padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); "><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Copyright 2010, Shuo Chen.  All rights reserved.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// http://code.google.com/p/muduo/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Use of this source code is governed by a BSD-style license</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// that can be found in the License file.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Author: Shuo Chen (chenshuo at chenshuo dot com)</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/net/Poller.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">using</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> muduo;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">using</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> muduo::net;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">Poller::Poller(EventLoop* loop)  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  : ownerLoop_(loop)  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">Poller::~Poller()  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li></ol></div>


PollPoller头文件

pollpoller.h

<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 743.4000244140625px; overflow: auto; padding-top: 1px; margin: 18px 0px !important; "><div class="bar" style="padding-left: 45px; "><div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(153, 153, 153); "><strong>[cpp]</strong> <a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="ViewSource" title="view plain" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">view plain</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="CopyToClipboard" title="copy" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">copy</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="PrintSource" title="print" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">print</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="About" title="?" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">?</a><div style="position: absolute; left: 402px; top: 8530px; width: 24px; height: 12px; z-index: 99; "><embed id="ZeroClipboardMovie_5" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="24" height="12" name="ZeroClipboardMovie_5" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=5&width=24&height=12" wmode="transparent" /></div></div></div><ol start="1" class="dp-cpp" style="margin: 0px 0px 1px 45px !important; padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); "><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Copyright 2010, Shuo Chen.  All rights reserved.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// http://code.google.com/p/muduo/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Use of this source code is governed by a BSD-style license</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// that can be found in the License file.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Author: Shuo Chen (chenshuo at chenshuo dot com)</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// This is an internal header file, you should not include this.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#ifndef MUDUO_NET_POLLER_POLLPOLLER_H</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#define MUDUO_NET_POLLER_POLLPOLLER_H</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/net/Poller.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <map></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <vector></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">struct</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> pollfd;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> muduo  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> net  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// IO Multiplexing with poll(2).</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">class</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> PollPoller : </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">public</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Poller  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "> <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">public</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">:  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  PollPoller(EventLoop* loop);  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">virtual</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> ~PollPoller();  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*返回活动的通道列表*/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">virtual</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Timestamp poll(</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> timeoutMs, ChannelList* activeChannels);  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">virtual</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> updateChannel(Channel* channel);  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">virtual</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> removeChannel(Channel* channel);  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "> <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">private</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">:  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> fillActiveChannels(</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> numEvents,  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">                          ChannelList* activeChannels) <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">typedef</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> std::vector<</span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">struct</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> pollfd> PollFdList;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">typedef</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> std::map<</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">, Channel*> ChannelMap; </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// key是文件描述符,value是Channel*</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  PollFdList pollfds_; <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 事件结构</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*被关注的通道列表 , 不是活动的通道列表*/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  ChannelMap channels_;  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">};  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#endif  // MUDUO_NET_POLLER_POLLPOLLER_H</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li></ol></div>

PollPoller源文件

pollpoller.cc

<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 743.4000244140625px; overflow: auto; padding-top: 1px; margin: 18px 0px !important; "><div class="bar" style="padding-left: 45px; "><div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(153, 153, 153); "><strong>[cpp]</strong> <a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="ViewSource" title="view plain" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">view plain</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="CopyToClipboard" title="copy" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">copy</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="PrintSource" title="print" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">print</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="About" title="?" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">?</a><div style="position: absolute; left: 402px; top: 9634px; width: 24px; height: 12px; z-index: 99; "><embed id="ZeroClipboardMovie_6" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="24" height="12" name="ZeroClipboardMovie_6" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=6&width=24&height=12" wmode="transparent" /></div></div></div><ol start="1" class="dp-cpp" style="margin: 0px 0px 1px 45px !important; padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); "><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Copyright 2010, Shuo Chen.  All rights reserved.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// http://code.google.com/p/muduo/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Use of this source code is governed by a BSD-style license</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// that can be found in the License file.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Author: Shuo Chen (chenshuo at chenshuo dot com)</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/net/poller/PollPoller.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/base/Logging.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/base/Types.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/net/Channel.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <assert.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <poll.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">using</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> muduo;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">using</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> muduo::net;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">PollPoller::PollPoller(EventLoop* loop)  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  : Poller(loop)  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">PollPoller::~PollPoller()  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*</span> </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">真正的poll 函数,终于到主角了^<>^  ///</span> </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">**/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">Timestamp PollPoller::poll(<span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> timeoutMs, ChannelList* activeChannels)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// XXX pollfds_ shouldn't change</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> numEvents = ::poll(&*pollfds_.begin(), pollfds_.size(), timeoutMs);  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  Timestamp now(Timestamp::now());  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//如果有活动事件 , 则填充到activeChannels 中去</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (numEvents > 0)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    LOG_TRACE << numEvents << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">" events happended"</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    fillActiveChannels(numEvents, activeChannels);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">else</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (numEvents == 0)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    LOG_TRACE << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">" nothing happended"</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">else</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    LOG_SYSERR << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"PollPoller::poll()"</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> now;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//填充活动通道</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// activeChannels 活动通道</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// pollfds_       已注册的事件集合</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*被关注的通道列表 , 不是活动的通道列表*/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> PollPoller::fillActiveChannels(</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> numEvents,  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">                                    ChannelList* activeChannels) <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">for</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (PollFdList::const_iterator pfd = pollfds_.begin();  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      pfd != pollfds_.end() && numEvents > 0; ++pfd)  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//返回活动的文件描述符</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (pfd->revents > 0)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      --numEvents;  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 从关注列表channels_中找出 已产生事件 的fd---》channel</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      ChannelMap::const_iterator ch = channels_.find(pfd->fd);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 断言是否已近到了channels_的尾部</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      assert(ch != channels_.end());  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 获取活动channel</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      Channel* channel = ch->second;   </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 断言channel的文件描述符是否和pfd 的描述符一致</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      assert(channel->fd() == pfd->fd);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 设置channel的事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      channel->set_revents(pfd->revents);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// pfd->revents = 0;</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 把活动channel 加入activeChannel容器</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      activeChannels->push_back(channel);  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*</span> </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">更行channel通道, </span> </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">**/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> PollPoller::updateChannel(Channel* channel)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//断言实在LoopThread 当中</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  Poller::assertInLoopThread();  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  LOG_TRACE << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"fd = "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << channel->fd() << </span><span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">" events = "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << channel->events();  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//如果新的通道,还没有注册事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (channel->index() < 0)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// index < 0说明是一个新的通道</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// a new one, add to pollfds_ </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//断言是新的通道</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    assert(channels_.find(channel->fd()) == channels_.end());  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//注册事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">struct</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> pollfd pfd;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    pfd.fd = channel->fd();  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    pfd.events = <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">static_cast</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "><</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">short</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">>(channel->events());  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    pfd.revents = 0;  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    pollfds_.push_back(pfd);  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//channel在pollfds中索引</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> idx = </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">static_cast</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "><</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">>(pollfds_.size())-1;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//更新channel的索引</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    channel->set_index(idx);  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//加入channels_ 的map中</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    channels_[pfd.fd] = channel;  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">else</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// update existing one</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//断言channel 已存在--》 channels_ ,index >0 < pollfds_.size()</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    assert(channels_.find(channel->fd()) != channels_.end());  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    assert(channels_[channel->fd()] == channel);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> idx = channel->index();  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    assert(0 <= idx && idx < <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">static_cast</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "><</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">>(pollfds_.size()));  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">struct</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> pollfd& pfd = pollfds_[idx];  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    assert(pfd.fd == channel->fd() || pfd.fd == -channel->fd()-1);  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//下面才是真正的更新</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    pfd.events = <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">static_cast</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "><</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">short</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">>(channel->events());  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//revents 貌似不用清零???</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    pfd.revents = 0;  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 将一个通道暂时更改为不关注事件,但不从Poller中移除该通道</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (channel->isNoneEvent())  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// ignore this pollfd</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 暂时忽略该文件描述符的事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 这里pfd.fd 可以直接设置为-1 , -1是为了排除0描述符的干扰</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      pfd.fd = -channel->fd()-1; <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 这样子设置是为了removeChannel优化</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 把channel 真正的从pollfds 中移除</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> PollPoller::removeChannel(Channel* channel)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  Poller::assertInLoopThread();  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  LOG_TRACE << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"fd = "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> << channel->fd();  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assert(channels_.find(channel->fd()) != channels_.end());  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assert(channels_[channel->fd()] == channel);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//要移除的channel一定是没有关注事件了 </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assert(channel->isNoneEvent());  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> idx = channel->index();  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assert(0 <= idx && idx < <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">static_cast</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "><</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">>(pollfds_.size()));  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">struct</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> pollfd& pfd = pollfds_[idx]; (</span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">)pfd;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assert(pfd.fd == -channel->fd()-1 && pfd.events == channel->events());  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//1-----------》先把channel 从channels_中移除</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">size_t</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> n = channels_.erase(channel->fd());  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assert(n == 1); (<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">)n;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//2-----------》如果是最后一个,则直接移除</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (implicit_cast<</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">size_t</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">>(idx) == pollfds_.size()-1)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    pollfds_.pop_back();  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">else</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 2----------》这里移除的算法复杂度是O(1),将待删除元素与最后一个元素交换再pop_back</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> channelAtEnd = pollfds_.back().fd;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    iter_swap(pollfds_.begin()+idx, pollfds_.end()-1);  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//channelAtEnd 是从 pollfds_ 里面拿出来的,所以可能是负数</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (channelAtEnd < 0)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      channelAtEnd = -channelAtEnd-1;  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    channels_[channelAtEnd]->set_index(idx);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    pollfds_.pop_back();  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li></ol></div>


Channel头文件

channel.h

<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 743.4000244140625px; overflow: auto; padding-top: 1px; margin: 18px 0px !important; "><div class="bar" style="padding-left: 45px; "><div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(153, 153, 153); "><strong>[cpp]</strong> <a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="ViewSource" title="view plain" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">view plain</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="CopyToClipboard" title="copy" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">copy</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="PrintSource" title="print" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">print</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="About" title="?" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">?</a><div style="position: absolute; left: 402px; top: 12954px; width: 24px; height: 12px; z-index: 99; "><embed id="ZeroClipboardMovie_7" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="24" height="12" name="ZeroClipboardMovie_7" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=7&width=24&height=12" wmode="transparent" /></div></div></div><ol start="1" class="dp-cpp" style="margin: 0px 0px 1px 45px !important; padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); "><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Copyright 2010, Shuo Chen.  All rights reserved.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// http://code.google.com/p/muduo/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Use of this source code is governed by a BSD-style license</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// that can be found in the License file.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Author: Shuo Chen (chenshuo at chenshuo dot com)</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// This is an internal header file, you should not include this.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#ifndef MUDUO_NET_CHANNEL_H</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#define MUDUO_NET_CHANNEL_H</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <boost/function.hpp></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <boost/noncopyable.hpp></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <boost/shared_ptr.hpp></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <boost/weak_ptr.hpp></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/base/Timestamp.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> muduo  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> net  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">class</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> EventLoop;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// A selectable I/O channel.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">///</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// This class doesn't own the file descriptor.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// The file descriptor could be a socket,</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// an eventfd, a timerfd, or a signalfd</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">class</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Channel : boost::noncopyable </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//不可拷贝的</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "> <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">public</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">:  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*事件回调处理函数*/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">typedef</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> boost::function<</span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">()> EventCallback;   </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*读事件的回调处理*/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">typedef</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> boost::function<</span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">(Timestamp)> ReadEventCallback;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*一个EventLoop 包含多个Channel , 一个channel只属于一个EventLoop</span> </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">  Channel(n)-----> EventLoop</span> </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">  */</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  Channel(EventLoop* loop, <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> fd);  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//虚构函数没干什么事^V^</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  ~Channel();  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> handleEvent(Timestamp receiveTime);  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*回调函数的注册*/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 读的回调函数</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> setReadCallback(</span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> ReadEventCallback& cb)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  { readCallback_ = cb; }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 写的回调函数</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> setWriteCallback(</span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> EventCallback& cb)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  { writeCallback_ = cb; }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 关闭的回调函数</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> setCloseCallback(</span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> EventCallback& cb)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  { closeCallback_ = cb; }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 出错的回调函数</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> setErrorCallback(</span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> EventCallback& cb)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  { errorCallback_ = cb; }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/*</span> </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">这个函数下一节才开始分析^V^ ...</span> </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">这个函数跟TcpConnection 生命周期是有关系的,为了防止在事件处理的时候</span> </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">  **/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// Tie this channel to the owner object managed by shared_ptr,</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/// prevent the owner object being destroyed in handleEvent.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> tie(</span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> boost::shared_ptr<</span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">>&);  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//channel 的描述符</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> fd() </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> { </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> fd_; }  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// channel注册的事件(关注的事件)</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> events() </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> { </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> events_; }  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// poller 实际返回的事件,</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> set_revents(</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> revt) { revents_ = revt; } </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// used by pollers</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//清空channel的事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// int revents() const { return revents_; }</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">bool</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> isNoneEvent() </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> { </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> events_ == kNoneEvent; }  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> enableReading() { events_ |= kReadEvent; update(); }  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// void disableReading() { events_ &= ~kReadEvent; update(); }</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> enableWriting() { events_ |= kWriteEvent; update(); }  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> disableWriting() { events_ &= ~kWriteEvent; update(); }  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> disableAll() { events_ = kNoneEvent; update(); }  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">bool</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> isWriting() </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> { </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> events_ & kWriteEvent; }  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// for Poller ; 在Poller数组中的索引</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> index() { </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> index_; }  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 设置channel在poller的索引</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> set_index(</span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> idx) { index_ = idx; }  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// for debug 事件的调试信息</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  string reventsToString() <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> doNotLogHup() { logHup_ = </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">false</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">; }  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  EventLoop* ownerLoop() { <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> loop_; }  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> remove();  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "> <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">private</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">:  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> update();  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> handleEventWithGuard(Timestamp receiveTime);  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//事件常量</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//没有事件就是说等于零</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">static</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> kNoneEvent;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">static</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> kReadEvent;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">static</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> kWriteEvent;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  EventLoop* loop_;         <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 所属EventLoop</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  fd_;           </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 文件描述符,但不负责关闭该文件描述符</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">        events_;       </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 关注的事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">        revents_;      </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// poll/epoll返回的事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">        index_;        </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// used by Poller.表示在poll的事件数组中的序号</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">bool</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">       logHup_;       </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// for POLLHUP</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 下面两个是负责生存期的控制</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  boost::weak_ptr<<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">> tie_;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">bool</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> tied_;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">bool</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> eventHandling_;      </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 是否处于处理事件中</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  ReadEventCallback readCallback_;  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  EventCallback writeCallback_;  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  EventCallback closeCallback_;  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  EventCallback errorCallback_;  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">};  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#endif  // MUDUO_NET_CHANNEL_H</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li></ol></div>

Channel源文件

channel.cc

<div class="dp-highlighter bg_cpp" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 743.4000244140625px; overflow: auto; padding-top: 1px; margin: 18px 0px !important; "><div class="bar" style="padding-left: 45px; "><div class="tools" style="padding: 3px 8px 10px 10px; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left-width: 3px; border-left-style: solid; border-left-color: rgb(153, 153, 153); "><strong>[cpp]</strong> <a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="ViewSource" title="view plain" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">view plain</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="CopyToClipboard" title="copy" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">copy</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="PrintSource" title="print" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">print</a><a target=_blank href="http://blog.csdn.net/laohan_/article/details/14292667#" class="About" title="?" style="color: rgb(160, 160, 160); text-decoration: none; background-image: none; background-color: inherit; border: none; padding: 0px; margin: 0px 10px 0px 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; ">?</a><div style="position: absolute; left: 402px; top: 15501px; width: 24px; height: 12px; z-index: 99; "><embed id="ZeroClipboardMovie_8" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="24" height="12" name="ZeroClipboardMovie_8" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=8&width=24&height=12" wmode="transparent" /></div></div></div><ol start="1" class="dp-cpp" style="margin: 0px 0px 1px 45px !important; padding: 0px; border: none; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); "><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Copyright 2010, Shuo Chen.  All rights reserved.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// http://code.google.com/p/muduo/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Use of this source code is governed by a BSD-style license</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// that can be found in the License file.</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// Author: Shuo Chen (chenshuo at chenshuo dot com)</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/base/Logging.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/net/Channel.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <muduo/net/EventLoop.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <sstream></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="preprocessor" style="margin: 0px; padding: 0px; border: none; color: gray; background-color: inherit; ">#include <poll.h></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">using</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> muduo;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">using</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">namespace</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> muduo::net;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Channel::kNoneEvent = 0; </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//没有事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Channel::kReadEvent = POLLIN | POLLPRI; </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//产生量可读事件或者紧急数据</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> </span><span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Channel::kWriteEvent = POLLOUT;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">Channel::Channel(EventLoop* loop, <span class="datatypes" style="margin: 0px; padding: 0px; border: none; color: rgb(46, 139, 87); background-color: inherit; font-weight: bold; ">int</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> fd__)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  : loop_(loop),  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    fd_(fd__),  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    events_(0),  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    revents_(0),  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    index_(-1),  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//没加入poller是,channel的索引为 -1 </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    logHup_(<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">true</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">),  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    tied_(<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">false</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">),  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    eventHandling_(<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">false</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">)   </span><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//channel的事件处理状态初始化为 false</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">Channel::~Channel()  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assert(!eventHandling_);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Channel::tie(</span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> boost::shared_ptr<</span><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">>& obj)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  tie_ = obj;  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  tied_ = <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">true</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//更新channel的事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Channel::update()  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  loop_->updateChannel(<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">this</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">);  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 调用这个函数之前确保调用disableAll</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//  void disableAll() { events_ = kNoneEvent; update()-->assert(isNoneEvent()); }</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Channel::remove()  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  assert(isNoneEvent());  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  loop_->removeChannel(<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">this</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">);  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/**</span> </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">  当时到达时,调用事件处理函数handleEvent进行处理</span> </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">*/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Channel::handleEvent(Timestamp receiveTime)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  boost::shared_ptr<<span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">> guard;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (tied_)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    guard = tie_.lock();  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (guard)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      handleEventWithGuard(receiveTime);  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">else</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    handleEventWithGuard(receiveTime);  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">/**</span> </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; "> 事件处理</span> </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">**/</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; "><span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">void</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> Channel::handleEventWithGuard(Timestamp receiveTime)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{<span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//把channel的事件处理状态设为 true</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  eventHandling_ = <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">true</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//如果poller返回的channel 事件是pollhup挂断(写时才会产生),并且不是可读的 </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> ((revents_ & POLLHUP) && !(revents_ & POLLIN))  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">// 如果挂断了</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (logHup_)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">      LOG_WARN << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"Channel::handle_event() POLLHUP"</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//如果挂断了,就返回closeCallback</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (closeCallback_) closeCallback_();  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//文件描述符不合法或者文件描述符没有打开</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (revents_ & POLLNVAL)  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    LOG_WARN << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"Channel::handle_event() POLLNVAL"</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (revents_ & (POLLERR | POLLNVAL))  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (errorCallback_) errorCallback_();  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//可读事件 , </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//POLLRDHUP :stream socket peer closed connection ,or shutdown writing half of connection</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//POLLPRI : there is urgent data to read </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (revents_ & (POLLIN | POLLPRI | POLLRDHUP))  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (readCallback_) readCallback_(receiveTime);  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//可写事件</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (revents_ & POLLOUT)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  {  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (writeCallback_) writeCallback_();  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  }  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit; ">//事件处理完后,把事件处理状态恢复为false状态</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  eventHandling_ = <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">false</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">string Channel::reventsToString() <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">const</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">{  </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  std::ostringstream oss;  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  oss << fd_ << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">": "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (revents_ & POLLIN)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    oss << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"IN "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (revents_ & POLLPRI)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    oss << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"PRI "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (revents_ & POLLOUT)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    oss << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"OUT "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (revents_ & POLLHUP)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    oss << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"HUP "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (revents_ & POLLRDHUP)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    oss << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"RDHUP "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (revents_ & POLLERR)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    oss << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"ERR "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">if</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> (revents_ & POLLNVAL)  </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">    oss << <span class="string" style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit; ">"NVAL "</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; ">;  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  </span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; color: inherit; line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">  <span class="keyword" style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit; font-weight: bold; ">return</span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit; "> oss.str().c_str();  </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); color: rgb(85, 85, 85); line-height: 17.600000381469727px; "><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit; ">}  </span></li></ol></div>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值