CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::service::MessageServicePresence Class Reference

#include <MessageServicePresence.h>

Inheritance diagram for edm::service::MessageServicePresence:
edm::Presence

Public Member Functions

 MessageServicePresence ()
 
 ~MessageServicePresence () override
 
- Public Member Functions inherited from edm::Presence
 Presence ()
 
virtual ~Presence ()=0
 

Private Member Functions

 MessageServicePresence (MessageServicePresence const &)=delete
 
void operator= (MessageServicePresence const &)=delete
 
std::shared_ptr< ThreadQueue > & queue ()
 
std::shared_ptr< ThreadQueue const > queue () const
 

Private Attributes

edm::propagate_const< std::shared_ptr< ThreadQueue > > m_queue
 
boost::thread m_scribeThread
 

Detailed Description

Definition at line 16 of file MessageServicePresence.h.

Constructor & Destructor Documentation

◆ MessageServicePresence() [1/2]

edm::service::MessageServicePresence::MessageServicePresence ( )

Definition at line 46 of file MessageServicePresence.cc.

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  {
64  std::shared_ptr<edm::service::AbstractMLscribe>(std::make_shared<MainThreadMLscribe>(queue())));
65  // change log 3
66  //std::cout << "MessageServicePresence ctor\n";
67  }

References queue(), and edm::MessageLoggerQ::setMLscribe_ptr().

◆ ~MessageServicePresence()

edm::service::MessageServicePresence::~MessageServicePresence ( )
override

Definition at line 69 of file MessageServicePresence.cc.

69  {
71  m_scribeThread.join();
72  MessageLoggerQ::setMLscribe_ptr(std::shared_ptr<edm::service::AbstractMLscribe>()); // change log 3
73  }

References m_scribeThread, edm::MessageLoggerQ::MLqEND(), and edm::MessageLoggerQ::setMLscribe_ptr().

◆ MessageServicePresence() [2/2]

edm::service::MessageServicePresence::MessageServicePresence ( MessageServicePresence const &  )
privatedelete

Member Function Documentation

◆ operator=()

void edm::service::MessageServicePresence::operator= ( MessageServicePresence const &  )
privatedelete

◆ queue() [1/2]

std::shared_ptr<ThreadQueue>& edm::service::MessageServicePresence::queue ( )
inlineprivate

Definition at line 28 of file MessageServicePresence.h.

28 { return get_underlying_safe(m_queue); }

References edm::get_underlying_safe(), and m_queue.

◆ queue() [2/2]

std::shared_ptr<ThreadQueue const> edm::service::MessageServicePresence::queue ( ) const
inlineprivate

Definition at line 27 of file MessageServicePresence.h.

27 { return get_underlying_safe(m_queue); }

References edm::get_underlying_safe(), and m_queue.

Referenced by MessageServicePresence().

Member Data Documentation

◆ m_queue

edm::propagate_const<std::shared_ptr<ThreadQueue> > edm::service::MessageServicePresence::m_queue
private

Definition at line 31 of file MessageServicePresence.h.

Referenced by queue().

◆ m_scribeThread

boost::thread edm::service::MessageServicePresence::m_scribeThread
private

Definition at line 32 of file MessageServicePresence.h.

Referenced by ~MessageServicePresence().

edm::service::MessageServicePresence::m_queue
edm::propagate_const< std::shared_ptr< ThreadQueue > > m_queue
Definition: MessageServicePresence.h:31
edm::MessageLoggerQ::instance
static MessageLoggerQ * instance()
Definition: MessageLoggerQ.cc:119
edm::service::MessageServicePresence::m_scribeThread
boost::thread m_scribeThread
Definition: MessageServicePresence.h:32
edm::service::MessageServicePresence::queue
std::shared_ptr< ThreadQueue const > queue() const
Definition: MessageServicePresence.h:27
edm::MessageLoggerQ::setMLscribe_ptr
static void setMLscribe_ptr(std::shared_ptr< edm::service::AbstractMLscribe > m)
Definition: MessageLoggerQ.cc:124
edm::Presence::Presence
Presence()
Definition: Presence.h:23
edm::get_underlying_safe
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:40
edm::service::ThreadQueue
Definition: ThreadQueue.h:27
edm::MessageLoggerQ::MLqEND
static void MLqEND()
Definition: MessageLoggerQ.cc:152