Skip to content

Commit f413aa4

Browse files
author
渡世白玉
committed
win下条件编译
1 parent bbfa547 commit f413aa4

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Server/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
#include <QDir>
66
#include <QTextStream>
77
#include <iostream>
8+
#ifndef Q_OS_WIN
89
#include "eventdispatcher_libev/eventdispatcher_libev.h"
10+
#endif
911

1012
void customMessageHandler(QtMsgType type, const QMessageLogContext &context,const QString & msg)
1113
{
@@ -43,8 +45,10 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext &context,cons
4345

4446
int main(int argc, char *argv[])
4547
{
46-
// qInstallMessageHandler(customMessageHandler);
48+
// qInstallMessageHandler(customMessageHandler);
49+
#ifndef Q_OS_WIN
4750
QCoreApplication::setEventDispatcher(new EventDispatcherLibEv());
51+
#endif
4852
QCoreApplication a(argc, argv);
4953
std::cout << "???" << std::endl;
5054
TcpServer ser;

Server/threadhandle.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ void ThreadHandle::initThreadType(ThreadType type, unsigned int max)
7171
else
7272
{
7373
QThread * tmp = new QThread;
74+
#ifndef Q_OS_WIN
7475
tmp->setEventDispatcher(new EventDispatcherLibEv());
76+
#endif
7577
threadSize.insert(tmp,0);
7678
tmp->start();
7779
}
@@ -84,8 +86,10 @@ void ThreadHandle::initThreadSize() //建立好线程并启动,
8486
QThread * tmp;
8587
for (unsigned int i = 0; i < size;++i)
8688
{
87-
tmp = new QThread;
89+
tmp = new QThread;
90+
#ifndef Q_OS_WIN
8891
tmp->setEventDispatcher(new EventDispatcherLibEv());
92+
#endif
8993
threadSize.insert(tmp,0);
9094
tmp->start();
9195
}
@@ -102,7 +106,9 @@ QThread * ThreadHandle::findHandleSize() //查找到线程里的连接数小于
102106
}
103107
}
104108
QThread * tmp = new QThread;
109+
#ifndef Q_OS_WIN
105110
tmp->setEventDispatcher(new EventDispatcherLibEv());
111+
#endif
106112
threadSize.insert(tmp,1);
107113
tmp->start();
108114
return tmp;

0 commit comments

Comments
 (0)