- mutex change to make simple thread usage in custom menu more stable

This commit is contained in:
Mark Vejvoda
2010-06-22 04:27:22 +00:00
parent 0a6c382750
commit 050be3a7fb

View File

@@ -1096,7 +1096,7 @@ void MenuStateCustomGame::simpleTask() {
needToRepublishToMasterserver = false; needToRepublishToMasterserver = false;
string newPublishToServerInfo = publishToServerInfo; string newPublishToServerInfo = publishToServerInfo;
publishToServerInfo = ""; publishToServerInfo = "";
safeMutex.ReleaseLock(true); //safeMutex.ReleaseLock(true);
if(republish == true) { if(republish == true) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
@@ -1117,22 +1117,22 @@ void MenuStateCustomGame::simpleTask() {
// uncomment to enable router setup check of this server // uncomment to enable router setup check of this server
//if(serverInfo!="OK") //if(serverInfo!="OK")
if(EndsWith(serverInfo, "OK") == false) { if(EndsWith(serverInfo, "OK") == false) {
safeMutex.Lock(); //safeMutex.Lock();
showMasterserverError=true; showMasterserverError=true;
masterServererErrorToShow=serverInfo; masterServererErrorToShow=serverInfo;
safeMutex.ReleaseLock(true); //safeMutex.ReleaseLock(true);
} }
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
safeMutex.Lock(); //safeMutex.Lock();
bool broadCastSettings = needToBroadcastServerSettings; bool broadCastSettings = needToBroadcastServerSettings;
if(publishToMasterserverThread == NULL || publishToMasterserverThread->getQuitStatus() == true || publishToMasterserverThread->getRunningStatus() == false) { if(publishToMasterserverThread == NULL || publishToMasterserverThread->getQuitStatus() == true || publishToMasterserverThread->getRunningStatus() == false) {
return; return;
} }
needToBroadcastServerSettings=false; needToBroadcastServerSettings=false;
safeMutex.ReleaseLock(true); //safeMutex.ReleaseLock(true);
if(broadCastSettings) { if(broadCastSettings) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);