2009-06-25

fdevent – 方便的跨平台IO多路复用接口

Views: 21296 | Add Comments

fdevent是一套方便的跨平台IO多路复用C语言接口, 主要想法来自 epoll 和 lighttpd 的 fdevent, 接口的使用几乎和 epoll 一样.

示例

while(1) {
    nfds = fdevents_wait(evs, 1000);
    if(nfds == 0){
        //printf("timeout\n");
        continue;
    }

    for(i = 0; i < nfds; i++) {
        fde = evs->events[i];

        if(fde->flags & FDEVENT_IN){
            // ...
        }

        if(fde->flags & FDEVENT_OUT){
            // ...
        }
    }
}

项目主页: http://www.ideawu.net/person/fdevent/

Related posts:

  1. Master-Workers 模式处理高负载
  2. 蛇形遍历数组
  3. Xcode 静态链接库找不到的问题
  4. 文件共享协议
Posted by ideawu at 2009-06-25 16:21:28

Leave a Comment