19 std::ostringstream ost;
29 std::string threadAppendix =
"" ;
32 std::string parent_name = name ;
33 std::string tool_name =
"" ;
34 size_t pp = name.find(
".") ;
35 if ( (pp > 0) && (pp <= name.length()) ) {
36 parent_name = name.substr(0,name.find(
".")-1) ;
37 tool_name = name.substr(name.find(
"."));
42 if ( (pp > 0) && (pp <= parent_name.length()) ) {
43 threadAppendix = parent_name.substr(parent_name.find(
threadSeparator)) ;
45 return threadAppendix ;
53 std::string genericName = name ;
56 std::string parent_name = name ;
57 std::string tool_name =
"" ;
58 size_t pp = name.find(
".") ;
59 if ( (pp > 0) && (pp <= name.length()) ) {
60 parent_name = name.substr(0,name.find(
".")-1) ;
61 tool_name = name.substr(name.find(
"."));
66 if ( (pp > 0) && (pp <= parent_name.length()) ) {
67 genericName = parent_name.substr(0,parent_name.find(
threadSeparator))+tool_name ;
87 (*m_threadMap)[0] =
"" ;
95 if ( 0 == ThreadGaudiInstance ) {
105 if (p_threadMap->count(s_pid) == 0 ) {
106 (*p_threadMap)[s_pid] = threadID ;
107 #ifdef THREAD_GAUDI__DEBUG
108 std::cout <<
" *** ThreadGaudi setThreadID *** value set for *** " << threadID <<
" thread ID : " << s_pid << std::endl ;
120 if ( p_threadMap->find(s_pid) != p_threadMap->end() ) {
121 return (*p_threadMap->find(s_pid)).second ;
123 return (*p_threadMap->find(0)).second ; ;
static ThreadGaudi * instance()
singleton access
const std::string & getThreadID()
get Gaudi ID of current pthread
void * ThreadHandle
A Thread handle.
ThreadGaudi * ThreadGaudiInstance
std::map< System::ThreadHandle, std::string > ThreadMap
std::string getGaudiThreadIDfromID(int iCopy)
helper function to extract Gaudi Thread ID from thread copy number
std::string getGaudiThreadGenericName(const std::string &name)
helper function to extract Gaudi instance name from thread copy name
singleton mapping the pthread ID to the Gaudi thread ID
ThreadMap * getThreadMap()
access the whole map
void setThreadID(const std::string &threadID)
associate Gaudi ID to pthread
const std::string threadSeparator
const std::string algToolSeparator
ThreadHandle threadSelf()
thread handle "accessor"
bool isGaudiThreaded(const std::string &name)
test if current Gaudi object is running /will run in a thread
std::string getGaudiThreadIDfromName(const std::string &name)
helper function to extract Gaudi Thread ID from thread copy name