Disable possible blocking writing to log and console for starting timer

This commit is contained in:
Benau 2019-11-07 12:20:37 +08:00
parent 148dc49817
commit 0f9688f5da
2 changed files with 6 additions and 6 deletions

View File

@ -970,9 +970,9 @@ void ClientLobby::startGame(Event* event)
return;
}
int sleep_time = (int)(start_time - cur_time);
Log::info("ClientLobby", "Start game after %dms", sleep_time);
std::this_thread::sleep_for(std::chrono::milliseconds(sleep_time));
Log::info("ClientLobby", "Started at %lf", StkTime::getRealTime());
//Log::info("ClientLobby", "Start game after %dms", sleep_time);
StkTime::sleep(sleep_time);
//Log::info("ClientLobby", "Started at %lf", StkTime::getRealTime());
m_state.store(RACING);
});
} // startGame

View File

@ -4086,9 +4086,9 @@ void ServerLobby::configPeersStartTime()
const uint64_t cur_time = STKHost::get()->getNetworkTimer();
assert(start_time > cur_time);
int sleep_time = (int)(start_time - cur_time);
Log::info("ServerLobby", "Start game after %dms", sleep_time);
std::this_thread::sleep_for(std::chrono::milliseconds(sleep_time));
Log::info("ServerLobby", "Started at %lf", StkTime::getRealTime());
//Log::info("ServerLobby", "Start game after %dms", sleep_time);
StkTime::sleep(sleep_time);
//Log::info("ServerLobby", "Started at %lf", StkTime::getRealTime());
m_state.store(RACING);
});
} // configPeersStartTime