Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
31
namespace
{
32
void
33
runMessageLoggerScribe(std::shared_ptr<ThreadQueue> queue)
34
{
35
sigset_t oldset;
36
edm::disableAllSigs
(&oldset);
37
MessageLoggerScribe
m
(queue);
38
m
.run();
39
// explicitly DO NOT reenableSigs(oldset) because -
40
// 1) When this terminates, the main thread may not yet have done a join() and we
41
// don't want to handle the sigs at that point in this thread
42
// 2) If we re-enable sigs, we will get the entire stack of accumulated ones (if any)
43
}
44
}
// namespace
45
46
namespace
edm {
47
namespace
service {
48
49
50
MessageServicePresence::MessageServicePresence
()
51
:
Presence
()
52
, m_queue (new
ThreadQueue
)
53
, m_scribeThread
54
( ( (void)
MessageLoggerQ
::
instance
()
// ensure Q's static data init'd
55
, std::bind(&runMessageLoggerScribe, m_queue)
56
// start a new thread, run rMLS(m_queue)
57
// ChangeLog 2
58
) )
59
// Note that m_scribeThread, which is a boost::thread, has a single-argument ctor -
60
// just the function to be run. But we need to do something first, namely,
61
// ensure that the MessageLoggerQ is in a valid state - and that requires
62
// a statement. So we bundle that statement in parenthesis, separated by
63
// a comma, with the argument we really want (runMessageLoggerScribe). This
64
// creates a single argument, wheich evaluates to runMessageLoggerScribe after
65
// first executing the before-the-comma statement.
66
{
67
MessageLoggerQ::setMLscribe_ptr
(
68
std::shared_ptr<edm::service::AbstractMLscribe>(std::make_shared<MainThreadMLscribe>(
m_queue
)));
69
// change log 3
70
//std::cout << "MessageServicePresence ctor\n";
71
}
72
73
74
MessageServicePresence::~MessageServicePresence
()
75
{
76
MessageLoggerQ::MLqEND
();
77
m_scribeThread
.join();
78
MessageLoggerQ::setMLscribe_ptr
79
(std::shared_ptr<edm::service::AbstractMLscribe>());
// change log 3
80
}
81
82
}
// end of namespace service
83
}
// end of namespace edm
edm::disableAllSigs
void disableAllSigs(sigset_t *oldset)
Definition:
UnixSignalHandlers.cc:36
edm::service::MessageServicePresence::~MessageServicePresence
~MessageServicePresence()
Definition:
MessageServicePresence.cc:74
instance
static PFTauRenderPlugin instance
Definition:
PFTauRenderPlugin.cc:70
MessageLoggerScribe.h
ThreadQueue.h
UnixSignalHandlers.h
edm::service::MessageServicePresence::MessageServicePresence
MessageServicePresence()
Definition:
MessageServicePresence.cc:50
MainThreadMLscribe.h
MessageServicePresence.h
edm::service::MessageServicePresence::m_scribeThread
boost::thread m_scribeThread
Definition:
MessageServicePresence.h:30
contentValuesFiles.m
tuple m
Definition:
contentValuesFiles.py:59
edm::service::ThreadQueue
Definition:
ThreadQueue.h:30
MessageLoggerQ.h
edm::service::MessageServicePresence::m_queue
std::shared_ptr< ThreadQueue > m_queue
Definition:
MessageServicePresence.h:29
edm::MessageLoggerQ::MLqEND
static void MLqEND()
Definition:
MessageLoggerQ.cc:176
edm::MessageLoggerQ::setMLscribe_ptr
static void setMLscribe_ptr(std::shared_ptr< edm::service::AbstractMLscribe > m)
Definition:
MessageLoggerQ.cc:139
edm::MessageLoggerQ
Definition:
MessageLoggerQ.h:25
edm::Presence
Definition:
Presence.h:21
edm::service::MessageLoggerScribe
Definition:
MessageLoggerScribe.h:84
Generated for CMSSW Reference Manual by
1.8.5