- trying to trace nig's crash (more debug info and safer code)

This commit is contained in:
Mark Vejvoda 2013-01-23 14:51:28 +00:00
parent 141f7eaa48
commit 7ecc7325ac
15 changed files with 109 additions and 54 deletions

View File

@ -234,8 +234,9 @@ AiInterface::AiInterface(Game &game, int factionIndex, int teamIndex,
} }
workerThread = NULL; workerThread = NULL;
} }
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
this->workerThread = new AiInterfaceThread(this); this->workerThread = new AiInterfaceThread(this);
this->workerThread->setUniqueID(__FILE__); this->workerThread->setUniqueID(mutexOwnerId);
this->workerThread->start(); this->workerThread->start();
} }

View File

@ -257,8 +257,9 @@ Renderer::Renderer() : BaseRenderer() {
} }
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
saveScreenShotThread = new SimpleTaskThread(this,0,25); saveScreenShotThread = new SimpleTaskThread(this,0,25);
saveScreenShotThread->setUniqueID(extractFileFromDirectoryPath(__FILE__).c_str()); saveScreenShotThread->setUniqueID(mutexOwnerId);
saveScreenShotThread->start(); saveScreenShotThread->start();
} }
} }
@ -266,20 +267,27 @@ Renderer::Renderer() : BaseRenderer() {
void Renderer::cleanupScreenshotThread() { void Renderer::cleanupScreenshotThread() {
if(saveScreenShotThread) { if(saveScreenShotThread) {
saveScreenShotThread->signalQuit(); saveScreenShotThread->signalQuit();
for(time_t elapsed = time(NULL); // for(time_t elapsed = time(NULL);
getSaveScreenQueueSize() > 0 && difftime((long int)time(NULL),elapsed) <= 7;) { // getSaveScreenQueueSize() > 0 && difftime((long int)time(NULL),elapsed) <= 7;) {
sleep(0); // sleep(0);
} // }
if(saveScreenShotThread->canShutdown(true) == true && // if(saveScreenShotThread->canShutdown(true) == true &&
saveScreenShotThread->shutdownAndWait() == true) { // saveScreenShotThread->shutdownAndWait() == true) {
//printf("IN MenuStateCustomGame cleanup - C\n"); // //printf("IN MenuStateCustomGame cleanup - C\n");
// delete saveScreenShotThread;
// }
// saveScreenShotThread = NULL;
if(saveScreenShotThread->shutdownAndWait() == true) {
delete saveScreenShotThread; delete saveScreenShotThread;
} }
saveScreenShotThread = NULL; saveScreenShotThread = NULL;
if(getSaveScreenQueueSize() > 0) { if(getSaveScreenQueueSize() > 0) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] FORCING MEMORY CLEANUP and NOT SAVING screenshots, saveScreenQueue.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,saveScreenQueue.size()); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] FORCING MEMORY CLEANUP and NOT SAVING screenshots, saveScreenQueue.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,saveScreenQueue.size());
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
MutexSafeWrapper safeMutex(&saveScreenShotThreadAccessor,mutexOwnerId);
for(std::list<std::pair<string,Pixmap2D *> >::iterator iter = saveScreenQueue.begin(); for(std::list<std::pair<string,Pixmap2D *> >::iterator iter = saveScreenQueue.begin();
iter != saveScreenQueue.end(); ++iter) { iter != saveScreenQueue.end(); ++iter) {
delete iter->second; delete iter->second;
@ -290,37 +298,57 @@ void Renderer::cleanupScreenshotThread() {
} }
Renderer::~Renderer() { Renderer::~Renderer() {
delete modelRenderer; try{
modelRenderer = NULL; if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
delete textRenderer;
textRenderer = NULL;
delete textRenderer3D;
textRenderer3D = NULL;
delete particleRenderer;
particleRenderer = NULL;
//resources delete modelRenderer;
for(int i=0; i<rsCount; ++i){ modelRenderer = NULL;
delete modelManager[i]; delete textRenderer;
modelManager[i] = NULL; textRenderer = NULL;
delete textureManager[i]; delete textRenderer3D;
textureManager[i] = NULL; textRenderer3D = NULL;
delete particleManager[i]; delete particleRenderer;
particleManager[i] = NULL; particleRenderer = NULL;
delete fontManager[i];
fontManager[i] = NULL; if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//resources
for(int i=0; i<rsCount; ++i){
delete modelManager[i];
modelManager[i] = NULL;
delete textureManager[i];
textureManager[i] = NULL;
delete particleManager[i];
particleManager[i] = NULL;
delete fontManager[i];
fontManager[i] = NULL;
}
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
// Wait for the queue to become empty or timeout the thread at 7 seconds
cleanupScreenshotThread();
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
mapSurfaceData.clear();
quadCache = VisibleQuadContainerCache();
quadCache.clearFrustrumData();
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
this->menu = NULL;
this->game = NULL;
this->gameCamera = NULL;
} }
catch(const exception &e) {
char szBuf[8096]="";
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nError [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
// Wait for the queue to become empty or timeout the thread at 7 seconds throw megaglest_runtime_error(szBuf);
cleanupScreenshotThread(); }
mapSurfaceData.clear();
quadCache = VisibleQuadContainerCache();
quadCache.clearFrustrumData();
this->menu = NULL;
this->game = NULL;
this->gameCamera = NULL;
} }
void Renderer::simpleTask(BaseThread *callingThread) { void Renderer::simpleTask(BaseThread *callingThread) {

View File

@ -4842,8 +4842,9 @@ int glestMain(int argc, char** argv) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] precache thread enabled = %d\n",__FILE__,__FUNCTION__,__LINE__,startCRCPrecacheThread); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] precache thread enabled = %d\n",__FILE__,__FUNCTION__,__LINE__,startCRCPrecacheThread);
if(startCRCPrecacheThread == true) { if(startCRCPrecacheThread == true) {
vector<string> techDataPaths = config.getPathListForType(ptTechs); vector<string> techDataPaths = config.getPathListForType(ptTechs);
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
preCacheThread = new FileCRCPreCacheThread(); preCacheThread = new FileCRCPreCacheThread();
preCacheThread->setUniqueID(__FILE__); preCacheThread->setUniqueID(mutexOwnerId);
preCacheThread->setTechDataPaths(techDataPaths); preCacheThread->setTechDataPaths(techDataPaths);
//preCacheThread->setFileCRCPreCacheThreadCallbackInterface(&preCacheThreadGame); //preCacheThread->setFileCRCPreCacheThreadCallbackInterface(&preCacheThreadGame);
preCacheThread->start(); preCacheThread->start();

View File

@ -807,8 +807,9 @@ void Program::init(WindowGl *window, bool initSound, bool toggleFullScreen){
if(BaseThread::shutdownAndWait(soundThreadManager) == true) { if(BaseThread::shutdownAndWait(soundThreadManager) == true) {
delete soundThreadManager; delete soundThreadManager;
} }
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
soundThreadManager = new SimpleTaskThread(&SoundRenderer::getInstance(),0,SOUND_THREAD_UPDATE_MILLISECONDS); soundThreadManager = new SimpleTaskThread(&SoundRenderer::getInstance(),0,SOUND_THREAD_UPDATE_MILLISECONDS);
soundThreadManager->setUniqueID(extractFileFromDirectoryPath(__FILE__).c_str()); soundThreadManager->setUniqueID(mutexOwnerId);
soundThreadManager->start(); soundThreadManager->start();
} }
} }
@ -886,8 +887,9 @@ void Program::stopSoundSystem() {
void Program::startSoundSystem() { void Program::startSoundSystem() {
stopSoundSystem(); stopSoundSystem();
if(SoundRenderer::getInstance().runningThreaded() == true) { if(SoundRenderer::getInstance().runningThreaded() == true) {
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
soundThreadManager = new SimpleTaskThread(&SoundRenderer::getInstance(),0,SOUND_THREAD_UPDATE_MILLISECONDS); soundThreadManager = new SimpleTaskThread(&SoundRenderer::getInstance(),0,SOUND_THREAD_UPDATE_MILLISECONDS);
soundThreadManager->setUniqueID(extractFileFromDirectoryPath(__FILE__).c_str()); soundThreadManager->setUniqueID(mutexOwnerId);
soundThreadManager->start(); soundThreadManager->start();
} }
} }

View File

@ -544,8 +544,9 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
ftpClientThread->start(); ftpClientThread->start();
} }
// Start http meta data thread // Start http meta data thread
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
modHttpServerThread = new SimpleTaskThread(this,0,200); modHttpServerThread = new SimpleTaskThread(this,0,200);
modHttpServerThread->setUniqueID(__FILE__); modHttpServerThread->setUniqueID(mutexOwnerId);
modHttpServerThread->start(); modHttpServerThread->start();
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);

View File

@ -705,8 +705,9 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
GraphicComponent::applyAllCustomProperties(containerName); GraphicComponent::applyAllCustomProperties(containerName);
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
publishToMasterserverThread = new SimpleTaskThread(this,0,200); publishToMasterserverThread = new SimpleTaskThread(this,0,200);
publishToMasterserverThread->setUniqueID(__FILE__); publishToMasterserverThread->setUniqueID(mutexOwnerId);
publishToMasterserverThread->start(); publishToMasterserverThread->start();
if(openNetworkSlots==true){ if(openNetworkSlots==true){

View File

@ -270,8 +270,10 @@ MenuStateMasterserver::MenuStateMasterserver(Program *program, MainMenu *mainMen
chatManager.setFont3D(CoreData::getInstance().getMenuFontNormal3D()); chatManager.setFont3D(CoreData::getInstance().getMenuFontNormal3D());
needUpdateFromServer = true; needUpdateFromServer = true;
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
updateFromMasterserverThread = new SimpleTaskThread(this,0,100); updateFromMasterserverThread = new SimpleTaskThread(this,0,100);
updateFromMasterserverThread->setUniqueID(extractFileFromDirectoryPath(__FILE__).c_str()); updateFromMasterserverThread->setUniqueID(mutexOwnerId);
updateFromMasterserverThread->start(); updateFromMasterserverThread->start();
if(Config::getInstance().getString("IRCServer","") != "") { if(Config::getInstance().getString("IRCServer","") != "") {

View File

@ -250,8 +250,9 @@ MenuStateMods::MenuStateMods(Program *program, MainMenu *mainMenu) :
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
// Start http meta data thread // Start http meta data thread
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
modHttpServerThread = new SimpleTaskThread(this,0,200); modHttpServerThread = new SimpleTaskThread(this,0,200);
modHttpServerThread->setUniqueID(__FILE__); modHttpServerThread->setUniqueID(mutexOwnerId);
modHttpServerThread->start(); modHttpServerThread->start();
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);

View File

@ -934,8 +934,9 @@ void ClientInterface::updateKeyframe(int frameCount) {
} }
else { else {
if(networkCommandListThread == NULL) { if(networkCommandListThread == NULL) {
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
networkCommandListThread = new SimpleTaskThread(this,0,0); networkCommandListThread = new SimpleTaskThread(this,0,0);
networkCommandListThread->setUniqueID(extractFileFromDirectoryPath(__FILE__).c_str()); networkCommandListThread->setUniqueID(mutexOwnerId);
networkCommandListThread->start(); networkCommandListThread->start();
} }

View File

@ -275,8 +275,9 @@ ConnectionSlot::ConnectionSlot(ServerInterface* serverInterface, int playerIndex
this->setSocket(NULL); this->setSocket(NULL);
this->slotThreadWorker = NULL; this->slotThreadWorker = NULL;
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
this->slotThreadWorker = new ConnectionSlotThread(this->serverInterface,playerIndex); this->slotThreadWorker = new ConnectionSlotThread(this->serverInterface,playerIndex);
this->slotThreadWorker->setUniqueID(__FILE__); this->slotThreadWorker->setUniqueID(mutexOwnerId);
this->slotThreadWorker->start(); this->slotThreadWorker->start();
this->ready = false; this->ready = false;

View File

@ -205,8 +205,9 @@ ServerInterface::ServerInterface(bool publishEnabled) :GameNetworkInterface() {
if(publishToMasterserverThread == NULL) { if(publishToMasterserverThread == NULL) {
if(needToRepublishToMasterserver == true || GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { if(needToRepublishToMasterserver == true || GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
publishToMasterserverThread = new SimpleTaskThread(this,0,125); publishToMasterserverThread = new SimpleTaskThread(this,0,125);
publishToMasterserverThread->setUniqueID(extractFileFromDirectoryPath(__FILE__).c_str()); publishToMasterserverThread->setUniqueID(mutexOwnerId);
publishToMasterserverThread->start(); publishToMasterserverThread->start();
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] needToRepublishToMasterserver = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,needToRepublishToMasterserver); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] needToRepublishToMasterserver = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,needToRepublishToMasterserver);
@ -2135,8 +2136,9 @@ bool ServerInterface::launchGame(const GameSettings *gameSettings) {
if(publishToMasterserverThread == NULL) { if(publishToMasterserverThread == NULL) {
if(needToRepublishToMasterserver == true || GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { if(needToRepublishToMasterserver == true || GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
publishToMasterserverThread = new SimpleTaskThread(this,0,125); publishToMasterserverThread = new SimpleTaskThread(this,0,125);
publishToMasterserverThread->setUniqueID(extractFileFromDirectoryPath(__FILE__).c_str()); publishToMasterserverThread->setUniqueID(mutexOwnerId);
publishToMasterserverThread->start(); publishToMasterserverThread->start();
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] needToRepublishToMasterserver = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,needToRepublishToMasterserver); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] needToRepublishToMasterserver = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,needToRepublishToMasterserver);

View File

@ -614,8 +614,9 @@ void Faction::init(
} }
workerThread = NULL; workerThread = NULL;
} }
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
this->workerThread = new FactionThread(this); this->workerThread = new FactionThread(this);
this->workerThread->setUniqueID(__FILE__); this->workerThread->setUniqueID(mutexOwnerId);
this->workerThread->start(); this->workerThread->start();
} }

View File

@ -50,16 +50,26 @@ BaseThread::~BaseThread() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s] ret [%d] END\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str(),ret); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s] ret [%d] END\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str(),ret);
MutexSafeWrapper safeMutexMasterList(&mutexMasterThreadList); MutexSafeWrapper safeMutexMasterList(&mutexMasterThreadList);
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s] ret [%d] END\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str(),ret);
if(masterThreadList.find(this) == masterThreadList.end()) { if(masterThreadList.find(this) == masterThreadList.end()) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s] ret [%d] END\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str(),ret);
char szBuf[8096]=""; char szBuf[8096]="";
snprintf(szBuf,8096,"invalid thread delete for ptr: %p",this); snprintf(szBuf,8096,"invalid thread delete for ptr: %p",this);
throw megaglest_runtime_error(szBuf); throw megaglest_runtime_error(szBuf);
} }
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s] ret [%d] END\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str(),ret);
masterThreadList[this]--; masterThreadList[this]--;
if(masterThreadList[this] <= 0) { if(masterThreadList[this] <= 0) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s] ret [%d] END\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str(),ret);
masterThreadList.erase(this); masterThreadList.erase(this);
} }
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s] ret [%d] END\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str(),ret);
safeMutexMasterList.ReleaseLock(); safeMutexMasterList.ReleaseLock();
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s] ret [%d] END\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str(),ret);
} }
bool BaseThread::isThreadDeleted(void *ptr) { bool BaseThread::isThreadDeleted(void *ptr) {

View File

@ -134,7 +134,8 @@ void FileCRCPreCacheThread::execute() {
new FileCRCPreCacheThread(techDataPaths, new FileCRCPreCacheThread(techDataPaths,
workerTechList, workerTechList,
this->processTechCB); this->processTechCB);
workerThread->setUniqueID(__FILE__); static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
workerThread->setUniqueID(mutexOwnerId);
preCacheWorkerThreadList.push_back(workerThread); preCacheWorkerThreadList.push_back(workerThread);
workerThread->start(); workerThread->start();
@ -368,8 +369,8 @@ SimpleTaskThread::~SimpleTaskThread() {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str()); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str());
//throw megaglest_runtime_error(ex.what()); throw megaglest_runtime_error(ex.what());
abort(); //abort();
} }
} }

View File

@ -1791,8 +1791,9 @@ void ClientSocket::startBroadCastClientThread(DiscoveredServersInterface *cb) {
ClientSocket::stopBroadCastClientThread(); ClientSocket::stopBroadCastClientThread();
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
broadCastClientThread = new BroadCastClientSocketThread(cb); broadCastClientThread = new BroadCastClientSocketThread(cb);
broadCastClientThread->setUniqueID(string(__FILE__) + string("_") + string(__FUNCTION__)); broadCastClientThread->setUniqueID(mutexOwnerId);
broadCastClientThread->start(); broadCastClientThread->start();
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
@ -2151,7 +2152,8 @@ void ServerSocket::startBroadCastThread() {
//printf("Start broadcast thread [%p]\n",broadCastThread); //printf("Start broadcast thread [%p]\n",broadCastThread);
broadCastThread->setUniqueID(string(__FILE__) + string("_") + string(__FUNCTION__)); static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
broadCastThread->setUniqueID(mutexOwnerId);
broadCastThread->start(); broadCastThread->start();
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);