FWCore
MessageService
src
MessageServicePresence.cc
Go to the documentation of this file.
1
// ----------------------------------------------------------------------
2
//
3
// MessageService Presence.cc
4
//
5
// Changes:
6
//
7
// 1 - 2/11/07 mf Added a call to edm::disableAllSigs(&oldset)
8
// to disable signals so that they are all handled
9
// by the event processor thread
10
//
11
// 2 - 8/10/09 mf Mods to support the use of abstract scribes
12
// cdj so that standalones can work easily
13
//
14
//
15
// 2 - 8/12/09 mf Mods to get ownership of mlscribe better
16
// cdj
17
//
18
//
19
20
#include "
FWCore/MessageService/interface/MainThreadMLscribe.h
"
21
#include "
FWCore/MessageService/interface/MessageServicePresence.h
"
22
#include "
FWCore/MessageService/interface/MessageLoggerScribe.h
"
23
#include "
FWCore/MessageService/interface/ThreadQueue.h
"
24
25
#include "
FWCore/MessageLogger/interface/MessageLoggerQ.h
"
26
#include "
FWCore/Utilities/interface/UnixSignalHandlers.h
"
27
28
using namespace
edm::service
;
29
30
namespace
{
31
void
runMessageLoggerScribe(std::shared_ptr<ThreadQueue>
queue
) {
32
sigset_t oldset;
33
edm::disableAllSigs
(&oldset);
34
MessageLoggerScribe
m
(
queue
);
35
m
.run();
36
// explicitly DO NOT reenableSigs(oldset) because -
37
// 1) When this terminates, the main thread may not yet have done a join() and we
38
// don't want to handle the sigs at that point in this thread
39
// 2) If we re-enable sigs, we will get the entire stack of accumulated ones (if any)
40
}
41
}
// namespace
42
43
namespace
edm
{
44
namespace
service
{
45
46
MessageServicePresence::MessageServicePresence
()
47
:
Presence
(),
48
m_queue(new
ThreadQueue
),
49
m_scribeThread(((
void
)
MessageLoggerQ
::
instance
()
// ensure Q's static data init'd
50
,
51
std
::bind(&runMessageLoggerScribe,
queue
())
52
// start a new thread, run rMLS(m_queue)
53
// ChangeLog 2
54
))
55
// Note that m_scribeThread, which is a boost::thread, has a single-argument ctor -
56
// just the function to be run. But we need to do something first, namely,
57
// ensure that the MessageLoggerQ is in a valid state - and that requires
58
// a statement. So we bundle that statement in parenthesis, separated by
59
// a comma, with the argument we really want (runMessageLoggerScribe). This
60
// creates a single argument, wheich evaluates to runMessageLoggerScribe after
61
// first executing the before-the-comma statement.
62
{
63
MessageLoggerQ::setMLscribe_ptr
(
64
std::shared_ptr<edm::service::AbstractMLscribe>(std::make_shared<MainThreadMLscribe>(
queue
())));
65
// change log 3
66
//std::cout << "MessageServicePresence ctor\n";
67
}
68
69
MessageServicePresence::~MessageServicePresence
() {
70
MessageLoggerQ::MLqEND
();
71
m_scribeThread
.join();
72
MessageLoggerQ::setMLscribe_ptr
(std::shared_ptr<edm::service::AbstractMLscribe>());
// change log 3
73
}
74
75
}
// end of namespace service
76
}
// end of namespace edm
MessageServicePresence.h
service
Definition:
service.py:1
edm::service::MessageServicePresence::m_scribeThread
boost::thread m_scribeThread
Definition:
MessageServicePresence.h:32
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::service::MessageServicePresence::queue
std::shared_ptr< ThreadQueue const > queue() const
Definition:
MessageServicePresence.h:27
edm::service::MessageServicePresence::MessageServicePresence
MessageServicePresence()
Definition:
MessageServicePresence.cc:46
MessageLoggerScribe.h
ThreadQueue.h
visualization-live-secondInstance_cfg.m
m
Definition:
visualization-live-secondInstance_cfg.py:72
edm::MessageLoggerQ::setMLscribe_ptr
static void setMLscribe_ptr(std::shared_ptr< edm::service::AbstractMLscribe > m)
Definition:
MessageLoggerQ.cc:124
MessageLoggerQ.h
edm::service::MessageLoggerScribe
Definition:
MessageLoggerScribe.h:86
MainThreadMLscribe.h
createBeamHaloJobs.queue
queue
Definition:
createBeamHaloJobs.py:343
UnixSignalHandlers.h
edm::service
Definition:
TFileService.h:95
edm::service::MessageServicePresence::~MessageServicePresence
~MessageServicePresence() override
Definition:
MessageServicePresence.cc:69
instance
static PFTauRenderPlugin instance
Definition:
PFTauRenderPlugin.cc:70
std
Definition:
JetResolutionObject.h:76
edm::MessageLoggerQ
Definition:
MessageLoggerQ.h:23
edm::service::ThreadQueue
Definition:
ThreadQueue.h:27
funct::void
TEMPL(T2) struct Divides void
Definition:
Factorize.h:29
edm::Presence
Definition:
Presence.h:21
edm::MessageLoggerQ::MLqEND
static void MLqEND()
Definition:
MessageLoggerQ.cc:152
edm::disableAllSigs
void disableAllSigs(sigset_t *oldset)
Definition:
UnixSignalHandlers.cc:38
Generated for CMSSW Reference Manual by
1.8.16