parent
a7fa1d9ec0
commit
bd42f51b38
|
@ -199,14 +199,21 @@ int main(int argc, char *argv[]) {
|
||||||
// 分析命令行,如果有 -s 或者 --server 就在命令行直接开服务器
|
// 分析命令行,如果有 -s 或者 --server 就在命令行直接开服务器
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.setApplicationDescription("FreeKill server");
|
parser.setApplicationDescription("FreeKill server");
|
||||||
parser.addHelpOption();
|
|
||||||
parser.addVersionOption();
|
parser.addVersionOption();
|
||||||
parser.addOption({{"s", "server"}, "start server at <port>", "port"});
|
parser.addOption({{"s", "server"}, "start server at <port>", "port"});
|
||||||
|
parser.addOption({{"h", "help"}, "display help information"});
|
||||||
QStringList cliOptions;
|
QStringList cliOptions;
|
||||||
for (int i = 0; i < argc; i++)
|
for (int i = 0; i < argc; i++)
|
||||||
cliOptions << argv[i];
|
cliOptions << argv[i];
|
||||||
|
|
||||||
parser.parse(cliOptions);
|
parser.parse(cliOptions);
|
||||||
|
if (parser.isSet("version")) {
|
||||||
|
parser.showVersion();
|
||||||
|
return 0;
|
||||||
|
} else if (parser.isSet("help")) {
|
||||||
|
parser.showHelp();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool startServer = parser.isSet("server");
|
bool startServer = parser.isSet("server");
|
||||||
ushort serverPort = 9527;
|
ushort serverPort = 9527;
|
||||||
|
|
|
@ -87,6 +87,7 @@ bool RoomThread::hasRequest() {
|
||||||
void RoomThread::trySleep(int ms) {
|
void RoomThread::trySleep(int ms) {
|
||||||
if (sema_wake.available() > 0) {
|
if (sema_wake.available() > 0) {
|
||||||
sema_wake.acquire(sema_wake.available());
|
sema_wake.acquire(sema_wake.available());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sema_wake.tryAcquire(1, ms);
|
sema_wake.tryAcquire(1, ms);
|
||||||
|
|
Loading…
Reference in New Issue