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