EventsImp用于完成事件的处理。
class EventsImp { EventBase* base_; PollerBase* poller_; std::atomic<bool> exit_; int wakeupFds_[2]; int nextTimeout_; SafeQueue<Task> tasks_; std::map<TimerId, TimerRepeatable> timerReps_; std::map<TimerId, Task> timers_; std::atomic<int64_t> timerSeq_; std::map<int, std::list<IdleNode>> idleConns_; std::set<TcpConnPtr> reconnectConns_; bool idleEnabled; EventsImp(EventBase* base, int taskCap); ~EventImp(); void init(); void callIdles(); IdleId registerIdle(int idle, const TcpConnPtr& con, const TcpCallBack& cb); void unregisterIdle(const IdleId& id); void updateIdle(const IdleId& id); void handleTimeouts(); void refreshNearest(const TimerId* tid = NULL); void repeatableTimeout(TimerRepeatable* tr); EventBase& exit(); bool exited(); void safeCall(Task&& task); void loop(); void loop_once(int waitMs); void wakup(); bool cancel(TimerId timerid); TimerId runAt(int64_t milli, Task&& task, int64_t interval); };
可以看出类EventsImp有成员变量:任务队列 SafeQueue<Task> tasks_ 见此链接:https://www.cnblogs.com/sssblog/p/11552037.html