RSocketServer::~RSocketServer() { VLOG(3) << "~RSocketServer .."; shutdownAndWait(); }
BaseThread::~BaseThread() { //printf("In ~BaseThread Line: %d uniqueID [%s]\n",__LINE__,uniqueID.c_str()); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str()); //BaseThread *base_thread = dynamic_cast<BaseThread *>(this); if(this->getStarted() == false) { time_t elapsed = time(NULL); for(;this->getStarted() == false && difftime((long int)time(NULL),elapsed) <= 3;) { sleep(5); } } if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str()); bool ret = shutdownAndWait(); 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); //printf("In ~BaseThread Line: %d uniqueID [%s]\n",__LINE__,uniqueID.c_str()); MutexSafeWrapper safeMutexMasterList(&mutexMasterThreadList); //printf("In ~BaseThread Line: %d uniqueID [%s]\n",__LINE__,uniqueID.c_str()); 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); //printf("In ~BaseThread Line: %d uniqueID [%s]\n",__LINE__,uniqueID.c_str()); 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]=""; snprintf(szBuf,8096,"invalid thread delete for ptr: %p",this); 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); //printf("In ~BaseThread Line: %d uniqueID [%s]\n",__LINE__,uniqueID.c_str()); masterThreadList[this]--; 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); } //printf("In ~BaseThread Line: %d uniqueID [%s]\n",__LINE__,uniqueID.c_str()); 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(); 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); delete mutexRunning; mutexRunning = NULL; delete mutexQuit; mutexQuit = NULL; delete mutexBeginExecution; mutexBeginExecution = NULL; delete mutexDeleteSelfOnExecutionDone; mutexDeleteSelfOnExecutionDone = NULL; delete mutexThreadObjectAccessor; mutexThreadObjectAccessor = NULL; delete mutexThreadOwnerValid; mutexThreadOwnerValid = NULL; delete mutexExecutingTask; mutexExecutingTask = NULL; delete mutexStarted; mutexStarted = NULL; //printf("In ~BaseThread Line: %d uniqueID [%s] [%p]\n",__LINE__,uniqueID.c_str(),this); }