CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes

edm::service::MainThreadMLscribe Class Reference

#include <MainThreadMLscribe.h>

Inheritance diagram for edm::service::MainThreadMLscribe:
edm::service::AbstractMLscribe

List of all members.

Public Member Functions

 MainThreadMLscribe (boost::shared_ptr< ThreadQueue > tqp)
virtual void runCommand (MessageLoggerQ::OpCode opcode, void *operand)
virtual ~MainThreadMLscribe ()

Static Public Member Functions

static ErrorLoggetErrorLog_ptr ()

Private Attributes

boost::shared_ptr< ThreadQueuem_queue

Static Private Attributes

static ErrorLogstatic_errorlog_p

Detailed Description

Definition at line 39 of file MainThreadMLscribe.h.


Constructor & Destructor Documentation

edm::service::MainThreadMLscribe::MainThreadMLscribe ( boost::shared_ptr< ThreadQueue tqp)

Definition at line 16 of file MainThreadMLscribe.cc.

  : m_queue(tqp) 
{
}
edm::service::MainThreadMLscribe::~MainThreadMLscribe ( ) [virtual]

Definition at line 21 of file MainThreadMLscribe.cc.

{}

Member Function Documentation

static ErrorLog* edm::service::MainThreadMLscribe::getErrorLog_ptr ( ) [inline, static]

Definition at line 52 of file MainThreadMLscribe.h.

References static_errorlog_p.

void edm::service::MainThreadMLscribe::runCommand ( MessageLoggerQ::OpCode  opcode,
void *  operand 
) [virtual]

Reimplemented from edm::service::AbstractMLscribe.

Definition at line 25 of file MainThreadMLscribe.cc.

References edm::ConfigurationHandshake::c, edm::ConfigurationHandshake::epp, h, edm::MessageLoggerQ::handshaked(), edm::ConfigurationHandshake::m, m_queue, and v.

{
  if (MessageLoggerQ::handshaked(opcode)) {
    Place_for_passing_exception_ptr epp(new Pointer_to_new_exception_on_heap());
    ConfigurationHandshake h(operand,epp);
    void * v(static_cast<void *>(&h));
    Pointer_to_new_exception_on_heap ep;
    {
      boost::mutex::scoped_lock sl(h.m);       // get lock
      m_queue->produce (opcode, v);
      // wait for result to appear (in epp)
      h.c.wait(sl); // c.wait(sl) unlocks the scoped lock and sleeps till notified
      // ... and once the MessageLoggerScribe does h.c.notify_all() ... 
      ep = *h.epp;
      // finally, release the scoped lock by letting it go out of scope 
    }
    if ( ep ) {
      edm::Exception ex(*ep);
      throw ex;
    }  
  } else {
    m_queue->produce (opcode, operand);
  }
} // runCommand

Member Data Documentation

Definition at line 57 of file MainThreadMLscribe.h.

Referenced by runCommand().

Definition at line 56 of file MainThreadMLscribe.h.

Referenced by getErrorLog_ptr().