CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
17  : m_queue(tqp)
18 {
19 }
20 
22 
23 void
25 runCommand(MessageLoggerQ::OpCode opcode, void * operand)
26 {
27  if (MessageLoggerQ::handshaked(opcode)) {
29  ConfigurationHandshake h(operand,epp);
30  void * v(static_cast<void *>(&h));
32  {
33  std::unique_lock<std::mutex> sl(h.m); // get lock
34  m_queue->produce (opcode, v);
35  // wait for result to appear (in epp)
36  h.c.wait(sl); // c.wait(sl) unlocks the scoped lock and sleeps till notified
37  // ... and once the MessageLoggerScribe does h.c.notify_all() ...
38  ep = *h.epp;
39  // finally, release the scoped lock by letting it go out of scope
40  }
41  if ( ep ) {
42  edm::Exception ex(*ep);
43  throw ex;
44  }
45  } else {
46  m_queue->produce (opcode, operand);
47  }
48 } // runCommand
49 
50 
51 
52 } // end of namespace service
53 } // end of namespace edm
static bool handshaked(const OpCode &op)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
edm::Place_for_passing_exception_ptr epp
edm::propagate_const< std::shared_ptr< ThreadQueue > > m_queue
MainThreadMLscribe(std::shared_ptr< ThreadQueue > tqp)
virtual void runCommand(MessageLoggerQ::OpCode opcode, void *operand)
std::shared_ptr< Pointer_to_new_exception_on_heap > Place_for_passing_exception_ptr
std::shared_ptr< edm::Exception > Pointer_to_new_exception_on_heap