CMS 3D CMS Logo

MainThreadMLscribe.cc
Go to the documentation of this file.
1 // ----------------------------------------------------------------------
2 //
3 // MainThreadMLscribe.cc
4 //
5 // Changes:
6 //
7 //
8 
12 
13 namespace edm {
14  namespace service {
15 
16  MainThreadMLscribe::MainThreadMLscribe(std::shared_ptr<ThreadQueue> tqp) : m_queue(tqp) {}
17 
19 
21  if (MessageLoggerQ::handshaked(opcode)) {
23  ConfigurationHandshake h(operand, epp);
24  void *v(static_cast<void *>(&h));
26  {
27  std::unique_lock<std::mutex> sl(h.m); // get lock
28  m_queue->produce(opcode, v);
29  // wait for result to appear (in epp)
30  h.c.wait(sl); // c.wait(sl) unlocks the scoped lock and sleeps till notified
31  // ... and once the MessageLoggerScribe does h.c.notify_all() ...
32  ep = *h.epp;
33  // finally, release the scoped lock by letting it go out of scope
34  }
35  if (ep) {
36  edm::Exception ex(*ep);
37  throw ex;
38  }
39  } else {
40  m_queue->produce(opcode, operand);
41  }
42  } // runCommand
43 
44  } // end of namespace service
45 } // end of namespace edm
service
Definition: service.py:1
edm::service::MainThreadMLscribe::~MainThreadMLscribe
~MainThreadMLscribe() override
Definition: MainThreadMLscribe.cc:18
edm
HLT enums.
Definition: AlignableModifier.h:19
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
findQualityFiles.v
v
Definition: findQualityFiles.py:179
ThreadQueue.h
edm::Exception
Definition: EDMException.h:77
edm::MessageLoggerQ::handshaked
static bool handshaked(const OpCode &op)
Definition: MessageLoggerQ.cc:186
edm::Place_for_passing_exception_ptr
std::shared_ptr< Pointer_to_new_exception_on_heap > Place_for_passing_exception_ptr
Definition: ConfigurationHandshake.h:13
edm::service::MainThreadMLscribe::runCommand
void runCommand(MessageLoggerQ::OpCode opcode, void *operand) override
Definition: MainThreadMLscribe.cc:20
h
MainThreadMLscribe.h
edm::ConfigurationHandshake
Definition: ConfigurationHandshake.h:15
edm::service::MainThreadMLscribe::m_queue
edm::propagate_const< std::shared_ptr< ThreadQueue > > m_queue
Definition: MainThreadMLscribe.h:50
edm::Pointer_to_new_exception_on_heap
std::shared_ptr< edm::Exception > Pointer_to_new_exception_on_heap
Definition: ConfigurationHandshake.h:10
ConfigurationHandshake.h
edm::service::MainThreadMLscribe::MainThreadMLscribe
MainThreadMLscribe(std::shared_ptr< ThreadQueue > tqp)
Definition: MainThreadMLscribe.cc:16
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::MessageLoggerQ::OpCode
OpCode
Definition: MessageLoggerQ.h:26