mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
parent
a7fa1d9ec0
commit
bd42f51b38
|
@ -199,14 +199,21 @@ int main(int argc, char *argv[]) {
|
|||
// 分析命令行,如果有 -s 或者 --server 就在命令行直接开服务器
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("FreeKill server");
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addOption({{"s", "server"}, "start server at <port>", "port"});
|
||||
parser.addOption({{"h", "help"}, "display help information"});
|
||||
QStringList cliOptions;
|
||||
for (int i = 0; i < argc; i++)
|
||||
cliOptions << argv[i];
|
||||
|
||||
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");
|
||||
ushort serverPort = 9527;
|
||||
|
|
|
@ -87,6 +87,7 @@ bool RoomThread::hasRequest() {
|
|||
void RoomThread::trySleep(int ms) {
|
||||
if (sema_wake.available() > 0) {
|
||||
sema_wake.acquire(sema_wake.available());
|
||||
return;
|
||||
}
|
||||
|
||||
sema_wake.tryAcquire(1, ms);
|
||||
|
|
Loading…
Reference in New Issue
Block a user