muduo库 TimerQueue 分析

定时器  时序图 对于定时任务的原理: muduo采用timerfd_*将超时任务转换成文件描述符进行监听 当时间一到,timerfd变为可读,相应的Channel调用回调函数(TimerQueue::handleRead) 回调函数中将所有在TimerQueue中的超时任务找出,一次调用其回调函数 对于周期性定时任务,再添加回TimerQueue中
相关文章
相关标签/搜索