Special TBB task used by ThreadPoolSvc to wrap execution of IThreadInitTools.
More...
#include </builds/gaudi/Gaudi/GaudiHive/src/ThreadInitTask.h>
Special TBB task used by ThreadPoolSvc to wrap execution of IThreadInitTools.
- Author
- Charles Leggett
Definition at line 29 of file ThreadInitTask.h.
◆ ThreadInitTask()
Definition at line 32 of file ThreadInitTask.h.
boost::barrier * m_barrier
SmartIF< ISvcLocator > m_serviceLocator
ToolHandleArray< IThreadInitTool > m_tools
◆ execFailed()
static bool ThreadInitTask::execFailed |
( |
| ) |
|
|
inlinestatic |
◆ operator()()
void ThreadInitTask::operator() |
( |
| ) |
const |
Execute the task.
Will loop over IThreadInitTools and execute each one.
Definition at line 28 of file ThreadInitTask.cpp.
28 {
29
31 MsgStream
log( messageSvc,
"ThreadInitTask" );
32
34
35 if ( debug )
36 log <<
MSG::DEBUG <<
"execute() in thread 0x" << std::hex << pthread_self() <<
" at " <<
this << std::dec
38
40 log <<
MSG::WARNING <<
"thread initialization has already been done on thread " << std::hex << pthread_self()
42 }
43
44
45 ToolHandleArray<IThreadInitTool> tools(
m_tools );
46
47 if ( tools.retrieve().isFailure() ) {
50 } else {
51
52 if ( tools.empty() ) {
55 } else {
56 if ( debug )
log <<
MSG::DEBUG <<
"executing in thread 0x" << std::hex << pthread_self() << std::dec <<
endmsg;
57
58
60 log <<
MSG::INFO <<
"Not calling terminateThread for thread 0x" << std::hex << pthread_self()
61 <<
" as it has not been initialized" <<
endmsg;
62 } else {
63
64 for ( auto& t : tools ) {
65 try {
66
68
72 } else {
74 }
75
76 } catch ( const GaudiException& exc ) {
77 log <<
MSG::ERROR <<
"ThreadInitTool " <<
t <<
" in thread 0x" << std::hex << pthread_self() << std::dec
78 <<
" threw GaudiException: " << exc <<
endmsg;
80 } catch ( const std::exception& exc ) {
81 log <<
MSG::ERROR <<
"ThreadInitTool " <<
t <<
" in thread 0x" << std::hex << pthread_self() << std::dec
82 <<
" threw std::exception: " << exc.what() <<
endmsg;
84 } catch ( ... ) {
85 log <<
MSG::ERROR <<
"ThreadInitTool " <<
t <<
" in thread 0x" << std::hex << pthread_self() << std::dec
86 <<
" threw unknown exception" <<
endmsg;
88 }
89 }
90 }
91
92 tools.release().ignore();
93 }
94 }
95
97 log <<
MSG::DEBUG <<
"waiting at barrier in thread 0x" << std::hex << pthread_self() << std::dec <<
endmsg;
99 }
100}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
thread_local bool ThreadInitDone
◆ m_barrier
boost::barrier* ThreadInitTask::m_barrier = nullptr |
|
private |
◆ m_execFailed
std::atomic< bool > ThreadInitTask::m_execFailed |
|
staticprivate |
◆ m_serviceLocator
◆ m_terminate
bool ThreadInitTask::m_terminate = false |
|
private |
◆ m_tools
The documentation for this class was generated from the following files: