- bugfix for mutex deadlock

This commit is contained in:
Mark Vejvoda 2010-06-18 20:04:05 +00:00
parent ebe75de00d
commit 2d50beecfa
6 changed files with 13 additions and 9 deletions

View File

@ -26,7 +26,7 @@ using namespace Shared::Platform;
namespace Glest{ namespace Game{
const string mailString= "contact_game@glest.org";
const string glestVersionString= "v3.3.5-beta7.6";
const string glestVersionString= "v3.3.5-beta7.7";
string getCrashDumpFileName(){
return "glest" + glestVersionString + ".dmp";

View File

@ -411,6 +411,7 @@ int glestMain(int argc, char** argv){
if(config.getBool("AllowGameDataSynchCheck","false") == true) {
vector<string> techDataPaths = config.getPathListForType(ptTechs);
preCacheThread.reset(new FileCRCPreCacheThread());
preCacheThread->setUniqueID(__FILE__);
preCacheThread->setTechDataPaths(techDataPaths);
preCacheThread->start();
}

View File

@ -404,6 +404,7 @@ void Program::init(WindowGl *window, bool initSound, bool toggleFullScreen){
BaseThread::shutdownAndWait(soundThreadManager);
delete soundThreadManager;
soundThreadManager = new SimpleTaskThread(&SoundRenderer::getInstance(),0,50);
soundThreadManager->setUniqueID(__FILE__);
soundThreadManager->start();
}
}

View File

@ -313,6 +313,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
chatManager.init(&console, -1,true);
publishToMasterserverThread = new SimpleTaskThread(this,0,25);
publishToMasterserverThread->setUniqueID(__FILE__);
publishToMasterserverThread->start();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
@ -324,11 +325,11 @@ MenuStateCustomGame::~MenuStateCustomGame() {
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
needToBroadcastServerSettings = false;
needToRepublishToMasterserver = false;
safeMutex.ReleaseLock();
//BaseThread::shutdownAndWait(publishToMasterserverThread);
delete publishToMasterserverThread;
publishToMasterserverThread = NULL;
safeMutex.ReleaseLock();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
@ -339,6 +340,8 @@ void MenuStateCustomGame::returnToParentMenu(){
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
needToBroadcastServerSettings = false;
needToRepublishToMasterserver = false;
bool returnToMasterServerMenu = parentMenuIsMs;
safeMutex.ReleaseLock();
//BaseThread::shutdownAndWait(publishToMasterserverThread);
delete publishToMasterserverThread;
@ -346,9 +349,6 @@ void MenuStateCustomGame::returnToParentMenu(){
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
bool returnToMasterServerMenu = parentMenuIsMs;
safeMutex.ReleaseLock();
if(returnToMasterServerMenu) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
mainMenu->setState(new MenuStateMasterserver(program, mainMenu));
@ -385,11 +385,12 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
needToBroadcastServerSettings = false;
needToRepublishToMasterserver = false;
safeMutex.ReleaseLock();
//BaseThread::shutdownAndWait(publishToMasterserverThread);
delete publishToMasterserverThread;
publishToMasterserverThread = NULL;
safeMutex.ReleaseLock();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
returnToParentMenu();
@ -440,10 +441,10 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
needToBroadcastServerSettings = false;
needToRepublishToMasterserver = false;
safeMutex.ReleaseLock();
//BaseThread::shutdownAndWait(publishToMasterserverThread);
delete publishToMasterserverThread;
publishToMasterserverThread = NULL;
safeMutex.ReleaseLock();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);

View File

@ -159,6 +159,7 @@ ConnectionSlot::ConnectionSlot(ServerInterface* serverInterface, int playerIndex
this->socket = NULL;
this->slotThreadWorker = NULL;
this->slotThreadWorker = new ConnectionSlotThread(this->serverInterface);
this->slotThreadWorker->setUniqueID(__FILE__);
this->slotThreadWorker->start();
this->ready = false;

View File

@ -68,14 +68,14 @@ bool BaseThread::getQuitStatus() {
}
bool BaseThread::getRunningStatus() {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str());
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str());
bool retval = false;
MutexSafeWrapper safeMutex(&mutexRunning);
retval = running;
safeMutex.ReleaseLock();
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s] running = %d\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str(),retval);
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s] running = %d\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str(),retval);
return retval;
}