ThreadGaudi Class Reference

singleton mapping the pthread ID to the Gaudi thread ID More...

#include <GaudiKernel/ThreadGaudi.h>

Collaboration diagram for ThreadGaudi:

Public Types

typedef std::map< System::ThreadHandle, std::string > ThreadMap
 
typedef std::map< System::ThreadHandle, std::string > ThreadMap
 

Public Member Functions

void setThreadID (const std::string &threadID)
 associate Gaudi ID to pthread More...
 
ThreadMapgetThreadMap ()
 access the whole map More...
 
const std::string & getThreadID ()
 get Gaudi ID of current pthread More...
 
void setThreadID (const std::string &threadID)
 associate Gaudi ID to pthread More...
 
ThreadMapgetThreadMap ()
 access the whole map More...
 
const std::string & getThreadID ()
 get Gaudi ID of current pthread More...
 

Static Public Member Functions

static ThreadGaudiinstance ()
 singleton access More...
 
static ThreadGaudiinstance ()
 singleton access More...
 

Protected Member Functions

 ThreadGaudi ()
 
virtual ~ThreadGaudi ()
 
 ThreadGaudi ()
 
virtual ~ThreadGaudi ()
 

Protected Attributes

ThreadMapm_threadMap
 

Detailed Description

singleton mapping the pthread ID to the Gaudi thread ID

Author
Werner Wiedenmann
Id
ThreadGaudi.h,v 1.3 2003/06/25 15:45:10 mato Exp

Definition at line 15 of file ThreadGaudi.h.

Member Typedef Documentation

typedef std::map< System::ThreadHandle , std::string > ThreadGaudi::ThreadMap

Definition at line 17 of file ThreadGaudi.h.

typedef std::map< System::ThreadHandle , std::string > ThreadGaudi::ThreadMap

Definition at line 17 of file ThreadGaudi.h.

Constructor & Destructor Documentation

ThreadGaudi::ThreadGaudi ( )
protected

Definition at line 85 of file ThreadGaudi.cpp.

85  {
86  m_threadMap = new ThreadMap();
87  (*m_threadMap)[0] = "" ;
88 }
std::map< System::ThreadHandle, std::string > ThreadMap
Definition: ThreadGaudi.h:17
ThreadMap * m_threadMap
Definition: ThreadGaudi.h:30
ThreadGaudi::~ThreadGaudi ( )
protectedvirtual

Definition at line 90 of file ThreadGaudi.cpp.

90  {
91  delete m_threadMap;
92 }
ThreadMap * m_threadMap
Definition: ThreadGaudi.h:30
ThreadGaudi::ThreadGaudi ( )
protected
virtual ThreadGaudi::~ThreadGaudi ( )
protectedvirtual

Member Function Documentation

const std::string & ThreadGaudi::getThreadID ( )

get Gaudi ID of current pthread

Definition at line 117 of file ThreadGaudi.cpp.

117  {
118  ThreadMap* p_threadMap = getThreadMap() ;
120  if ( p_threadMap->find(s_pid) != p_threadMap->end() ) {
121  return (*p_threadMap->find(s_pid)).second ;
122  } else {
123  return (*p_threadMap->find(0)).second ; ;
124  }
125 }
std::map< System::ThreadHandle, std::string > ThreadMap
Definition: ThreadGaudi.h:17
constexpr double second
ThreadMap * getThreadMap()
access the whole map
void * ThreadHandle
A Thread handle.
Definition: System.h:111
ThreadHandle threadSelf()
thread handle "accessor"
Definition: System.h:113
const std::string& ThreadGaudi::getThreadID ( )

get Gaudi ID of current pthread

ThreadGaudi::ThreadMap * ThreadGaudi::getThreadMap ( )

access the whole map

Definition at line 113 of file ThreadGaudi.cpp.

113  {
115 }
static ThreadGaudi * instance()
singleton access
Definition: ThreadGaudi.cpp:94
ThreadMap * m_threadMap
Definition: ThreadGaudi.h:30
ThreadMap* ThreadGaudi::getThreadMap ( )

access the whole map

static ThreadGaudi* ThreadGaudi::instance ( )
static

singleton access

ThreadGaudi * ThreadGaudi::instance ( )
static

singleton access

Definition at line 94 of file ThreadGaudi.cpp.

94  {
95  if ( 0 == ThreadGaudiInstance ) {
97  }
98  return ThreadGaudiInstance ;
99 }
ThreadGaudi * ThreadGaudiInstance
Definition: ThreadGaudi.cpp:83
void ThreadGaudi::setThreadID ( const std::string &  threadID)

associate Gaudi ID to pthread

void ThreadGaudi::setThreadID ( const std::string &  threadID)

associate Gaudi ID to pthread

Definition at line 101 of file ThreadGaudi.cpp.

101  {
102  ThreadMap* p_threadMap = getThreadMap() ;
103  // get from name thread ID
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 ;
109 #endif
110  }
111 }
std::map< System::ThreadHandle, std::string > ThreadMap
Definition: ThreadGaudi.h:17
ThreadMap * getThreadMap()
access the whole map
void * ThreadHandle
A Thread handle.
Definition: System.h:111
ThreadHandle threadSelf()
thread handle "accessor"
Definition: System.h:113

Member Data Documentation

ThreadMap * ThreadGaudi::m_threadMap
protected

Definition at line 30 of file ThreadGaudi.h.


The documentation for this class was generated from the following files: