Skip to content
Snippets Groups Projects
Commit ea1b2c49 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'Geant4MTFix_ATLASSIM-4062_master' into 'master'

Protection against calling G4ThreadInitTool::terminateThread without having called initThread

See merge request atlas/athena!21932
parents a8ac2b13 51c78246
No related branches found
No related tags found
No related merge requests found
...@@ -114,12 +114,23 @@ void G4ThreadInitTool::initThread() ...@@ -114,12 +114,23 @@ void G4ThreadInitTool::initThread()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void G4ThreadInitTool::terminateThread() void G4ThreadInitTool::terminateThread()
{ {
ATH_MSG_INFO("terminateThread ==> tbb thread 0x" << ATH_MSG_DEBUG("terminateThread ==> tbb thread 0x" <<
std::hex << pthread_self() << std::dec); std::hex << pthread_self() << std::dec);
// Geant4 worker finalization // Geant4 worker finalization
G4RunManager::GetRunManager()->RunTermination(); auto runMgr = G4RunManager::GetRunManager();
ATH_MSG_DEBUG("G4RunManager ptr" << runMgr);
// Atomic decrement number of initialized threads if(runMgr) {
m_nInitThreads--; runMgr->RunTermination();
ATH_MSG_INFO("terminateThread ==> safely called G4AtlasWorkerRunManager::RunTermination for tbb thread 0x" <<
std::hex << pthread_self() << std::dec);
// Atomic decrement number of initialized threads
m_nInitThreads--;
}
else {
ATH_MSG_WARNING("skipping attempt to call terminateThread for tbb thread 0x" <<
std::hex << pthread_self() << std::dec <<
" without having first called initThread.");
// Not decrementing m_nInitThreads as initThread was not called in this case.
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment