Thread线程类
- EventLoop包括底层的Poller(也就是事件分发器epoll)不会只工作在一个线程中;
- 是one loop per thread,一个loop对应一个线程,一个线程对应一个loop;
现在我们已经将EventLoop中的Channel,Poller,EpollPoller都实现完了;
接下来剖析和EventLoop相关的Thread类,设计三个类:
1、EventLoopThreadPool:事件循环的线程池,管理事件循环线程调度的;(这段代码是在TcpServer中的)
2、EventLoopThread:
- 在EventLoopThreadPool类中,是EventLoopThreadPool管理的EventLoopThread对象;
- EventLoopThread打包了一个EventLoop和一个Thread; (绑定了一个loop的thread)