資源簡介
最近在開發im服務器 需要大并發鏈接 QT默認的是使用select模型的 這種輪詢方式非常慢 在高并發連接 我們需要epoll才能發揮linux服務器的性能 而且使用簡單 整個服務端代碼架構無需修改 直接可以使用
只要在 main文件添加:
int main int argc char argv[]
{
#ifdef Q OS LINUX
QCoreApplication::setEventDispatcher new EventDispatcherLibEvent ;
qInstallMessageHandler customMessageHandler ;
代碼片段和文件信息
#include?“common.h“
#include?“eventdispatcher_libevent.h“
#include?“eventdispatcher_libevent_p.h“
/**
?*?@class?EventDispatcherLibEvent
?*?@brief?The?EventDispatcherLibEvent?class?provides?an?interface?to?manage?Qt‘s?event?queue.
?*
?*?An?event?dispatcher?receives?events?from?the?window?system?and?other
?*?sources.?It?then?sends?them?to?the?QCoreApplication?or?QApplication
?*?instance?for?processing?and?delivery.?EventDispatcherLibEvent?provides
?*?fine-grained?control?over?event?delivery.
?*
?*?For?simple?control?of?event?processing?use
?*?QCoreApplication::processEvents().
?*
?*?For?finer?control?of?the?application‘s?event?loop?call
?*?instance()?and?call?functions?on?the?QAbstractEventDispatcher
?*?object?that?is?returned.
?*
?*?To?use?EventDispatcherLibEvent?you?must?install?it?with
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????771??2014-07-02?10:52??eventdispatcher_libevent\common.h
?????文件??????10423??2014-07-02?10:52??eventdispatcher_libevent\eventdispatcher_libevent.cpp
?????文件???????1787??2014-07-02?10:52??eventdispatcher_libevent\eventdispatcher_libevent.h
?????文件???????2797??2014-07-02?10:52??eventdispatcher_libevent\eventdispatcher_libevent_config.cpp
?????文件???????1320??2014-07-02?10:52??eventdispatcher_libevent\eventdispatcher_libevent_config.h
?????文件????????534??2014-07-02?10:52??eventdispatcher_libevent\eventdispatcher_libevent_config_p.h
?????文件???????7051??2014-07-02?10:52??eventdispatcher_libevent\eventdispatcher_libevent_p.cpp
?????文件???????2569??2014-07-02?10:52??eventdispatcher_libevent\eventdispatcher_libevent_p.h
?????文件????????843??2014-07-08?18:16??eventdispatcher_libevent\eventdispatcher_libevent_qpa.cpp
?????文件????????638??2014-07-02?10:52??eventdispatcher_libevent\eventdispatcher_libevent_qpa.h
?????文件???????1204??2014-07-02?10:52??eventdispatcher_libevent\libevent2-emul.h
?????文件???????1754??2014-07-02?10:52??eventdispatcher_libevent\qt4compat.h
?????文件???????2559??2014-07-02?10:52??eventdispatcher_libevent\socknot_p.cpp
?????文件????????730??2014-07-08?19:42??eventdispatcher_libevent\tco.cpp
?????文件????????664??2014-07-08?19:40??eventdispatcher_libevent\tco.h
?????文件???????2554??2014-07-08?19:40??eventdispatcher_libevent\tco_eventfd.cpp
?????文件???????3426??2014-07-08?19:40??eventdispatcher_libevent\tco_pipe.cpp
?????文件???????1865??2014-07-02?10:52??eventdispatcher_libevent\tco_win32_libevent.cpp
?????文件???????8349??2014-07-02?10:52??eventdispatcher_libevent\timers_p.cpp
?????文件????????771??2014-07-02?10:52??eventdispatcher_libevent\wsainit.h
?????目錄??????????0??2014-07-08?19:56??eventdispatcher_libevent
-----------?---------??----------?-----??----
????????????????52609????????????????????21
- 上一篇:利用GMS和MapGIS建立地層模型
- 下一篇:數據結構1800試題題解
評論
共有 條評論