mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-21 00:19:29 +02:00
Removed usage of boost::thread from vcmi, except for AI
This commit is contained in:
@ -64,20 +64,14 @@ CServerHandler::~CServerHandler()
|
||||
if (serverRunner)
|
||||
serverRunner->shutdown();
|
||||
networkHandler->stop();
|
||||
try
|
||||
|
||||
if (serverRunner)
|
||||
serverRunner->wait();
|
||||
serverRunner.reset();
|
||||
if (threadNetwork.joinable())
|
||||
{
|
||||
if (serverRunner)
|
||||
serverRunner->wait();
|
||||
serverRunner.reset();
|
||||
{
|
||||
auto unlockInterface = vstd::makeUnlockGuard(ENGINE->interfaceMutex);
|
||||
threadNetwork.join();
|
||||
}
|
||||
}
|
||||
catch (const std::runtime_error & e)
|
||||
{
|
||||
logGlobal->error("Failed to shut down network thread! Reason: %s", e.what());
|
||||
assert(0);
|
||||
auto unlockInterface = vstd::makeUnlockGuard(ENGINE->interfaceMutex);
|
||||
threadNetwork.join();
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,6 +80,8 @@ void CServerHandler::endNetwork()
|
||||
if (client)
|
||||
client->endNetwork();
|
||||
networkHandler->stop();
|
||||
|
||||
if (threadNetwork.joinable())
|
||||
{
|
||||
auto unlockInterface = vstd::makeUnlockGuard(ENGINE->interfaceMutex);
|
||||
threadNetwork.join();
|
||||
@ -792,20 +788,20 @@ void CServerHandler::debugStartTest(std::string filename, bool save)
|
||||
else
|
||||
startLocalServerAndConnect(false);
|
||||
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
|
||||
while(!settings["session"]["headless"].Bool() && !ENGINE->windows().topWindow<CLobbyScreen>())
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
|
||||
while(!mi || mapInfo->fileURI != mi->fileURI)
|
||||
{
|
||||
setMapInfo(mapInfo);
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
// "Click" on color to remove us from it
|
||||
setPlayer(myFirstColor());
|
||||
while(myFirstColor() != PlayerColor::CANNOT_DETERMINE)
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
|
||||
while(true)
|
||||
{
|
||||
@ -818,7 +814,7 @@ void CServerHandler::debugStartTest(std::string filename, bool save)
|
||||
{
|
||||
|
||||
}
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user