Advertisement

第12个boost::asio序列:基于epoll的事件循环反应式架构

阅读量:

在epoll_reactor中,通过调用**epoll_wait(....)**来完成对I/O事件的监测,一旦检测到就绪事件,便将其纳入ops队列,静候调度器进行任务分配与执行。

复制代码
 void epoll_reactor::run(long usec, op_queue<operation>& ops)

    
 {
    
   // This code relies on the fact that the scheduler queues the reactor task
    
   // behind all descriptor operations generated by this function. This means,
    
   // that by the time we reach this point, any previously returned descriptor
    
   // operations have already been dequeued. Therefore it is now safe for us to
    
   // reuse and return them for the scheduler to queue again.
    
  
    
   // Calculate ti

全部评论 (0)

还没有任何评论哟~