05 2015 档案
摘要:这一节首先分析Libev的定时器部分,然后分析signal部分。对定时器的使用主要有两个函数:ev_timer_init (&timeout_watcher, timeout_cb, 5.5, 0.);ev_timer_start (loop, &timeout_watcher);和ev_io类型的...
阅读全文
摘要:设置完需要监听的事件之后,就开始event loop了。在Libev中,该工作由ev_run函数完成。它的大致流程如下:intev_run (EV_P_ int flags){ do { /* 执行EV_FORK类型事件 */ /* 执行EV_PREPARE类型事件 */...
阅读全文
摘要:这一节根据官方文档给出的简单示例,深入代码内部,了解其实现机制。示例代码如下:intmain (void){ struct ev_loop *loop = EV_DEFAULT; ev_io_init (&stdin_watcher, stdin_cb, /*STDIN_FILENO*/...
阅读全文