让Libevent 在window下 支持 IOCP
来源:互联网 发布:菜鸟程序员 编辑:程序博客网 时间:2024/06/04 18:10
Libevent 的强大就不说了,但由于在window下使用的是 select 机制 ,除了效率低下意外还有一个讨厌的"FD_SETSIZE"限制,所以一直希望能支持IOCP,可是现在已经到2.0还是没能够支持。
无意中在网上发现了个支持IOCP的libevent版本,是1.4.7版的。不过没关系,把其中的一个关键文件"win32iocp.c"拷贝到最新的1.4.14b版本中,并在"event.c"中修改:
.....
#ifdef HAVE_POLL
extern const struct eventop pollops;
#endif
#ifdef HAVE_EPOLL
extern const struct eventop epollops;
#endif
#ifdef HAVE_WORKING_KQUEUE
extern const struct eventop kqops;
#endif
#ifdef HAVE_DEVPOLL
extern const struct eventop devpollops;
#endif
#ifdef WIN32
#ifndef _EVENT_NOIOCP
extern const struct eventop win32iocpops;
#endif
extern const struct eventop win32ops;
#endif
.....
static const struct eventop *eventops[] = {
#ifdef HAVE_EVENT_PORTS
&evportops,
#endif
#ifdef HAVE_WORKING_KQUEUE
&kqops,
#endif
#ifdef HAVE_EPOLL
&epollops,
#endif
#ifdef HAVE_DEVPOLL
&devpollops,
#endif
#ifdef HAVE_POLL
&pollops,
#endif
#ifdef HAVE_SELECT
&selectops,
#endif
#ifdef WIN32
#ifndef _EVENT_NOIOCP
&win32iocpops,
#endif
&win32ops,
#endif
NULL
};
....
红色部分是添加的。
这样就可以很好的支持IOCP了。
附: win32iocp.c 代码
- 让Libevent 在window下 支持 IOCP
- window下如何让php支持openssl
- window下如何让php支持openssl
- libevent源码分析---让libevent支持多线程
- libevent源码分析---让libevent支持多线程
- libevent 在window环境编译
- libevent 在window环境编译
- libevent源码深度剖析12(让libevent支持多线程)
- 在WINXP下,让IIS支持PHP
- libevent IOCP完整教程
- libevent在vs下编译
- 让libevent支持多线程 (使用socketpair通知方式)
- 在ubuntu Linux下让Eclipse支持GBK编码
- 转载 在ubuntu Linux下让Eclipse支持GBK编码
- 如何在windows下让apache支持asp,通过iasp
- 在windows7下让zend studio支持aptana.
- 在linux系统下让sqlplus支持历史命令调用
- 让Flex在全屏模式下支持键盘输入
- 无奈
- 向着第二层 第一阶段第一天
- 两个文本框内容交换(js收藏1)
- cstring变量与atlsimpstr.h 的异常【创+转】
- TimerTask demo
- 让Libevent 在window下 支持 IOCP
- 动态存储变量和静态存储变量
- 用JAVA,删除文件中前100个字节的内容
- 目录拷贝、删除和搬移的操作
- 用Main()不能用main()
- ArcSDE备份恢复建议方案
- CView类详解 onActivateView()
- JQuery代码笔记
- 深入剖析微软Office Word主控文档利与弊