首页 / 操作系统 / Linux / epoll for qt网络模块,直接替换qt的select模型
最近在开发im服务器,需要大并发链接。QT默认的是使用select模型的,这种轮询方式非常慢。我 github找到了epoll版本的qt.修改了QT的socket notify内核,不需要修改原来编写的代码,直接设置QT的事件转发方式就行了。支持qt4.0和5.0在 main文件添加#include<QCoreApplication>#include"configserver.h"#include<QThread> #ifdefQ_OS_LINUX#include"qeventdispatcher_epoll.h"#endif intmain(intargc,char*argv[]){ #ifdefQ_OS_LINUXQCoreApplication::setEventDispatcher(newQEventDispatcherEpoll);#endif QCoreApplicationa(argc,argv); returna.exec();}在。pro文件添加linux{QT += core-private SOURCES += ../common/qeventdispatcher_epoll.cppHEADERS += ../common/qeventdispatcher_epoll.h}可以直接跨平台了使用了。上qt epoll源码下载地址:------------------------------------------分割线------------------------------------------FTP地址:ftp://ftp1.linuxidc.com用户名:ftp1.linuxidc.com密码:www.linuxidc.com在 2014年LinuxIDC.com4月epoll for qt网络模块,直接替换qt的select模型下载方法见 http://www.linuxidc.com/Linux/2013-10/91140.htm------------------------------------------分割线------------------------------------------Qt 的详细介绍:请点这里
Qt 的下载地址:请点这里推荐阅读:Ubuntu 环境下Gtk与QT编译环境安装与配置 http://www.linuxidc.com/Linux/2013-08/88539.htmLinux系统下QT环境搭建 http://www.linuxidc.com/Linux/2013-07/87576.htmUbuntu下QT控制台程序无法运行的解决方案以及XTerm的配置方法 http://www.linuxidc.com/Linux/2013-06/86244.htmUbuntu 10.04下QT4.7.4移植详解 http://www.linuxidc.com/Linux/2013-01/77930.htmLinux下为刚安装好的Qt Creator 创建桌面启动图标 http://www.linuxidc.com/Linux/2012-08/67214.htmUbuntu 11.04安装QT Creator 2.5.0 http://www.linuxidc.com/Linux/2012-06/62607.htmQt creator for PlayBook安装过程 http://www.linuxidc.com/Linux/2012-05/60652.htm