Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "FWCore/MessageService/interface/ThreadQueue.h"
00010 #include <cstring>
00011
00012 namespace edm {
00013 namespace service {
00014
00015 ThreadQueue::ThreadQueue()
00016 : m_buf (buf_size, buf_depth)
00017 {
00018 }
00019 ThreadQueue::~ThreadQueue() {}
00020
00021 void
00022 ThreadQueue::
00023 produce(MessageLoggerQ::OpCode o, void * operand)
00024 {
00025 SingleConsumerQ::ProducerBuffer b(m_buf);
00026 char * slot_p = static_cast<char *>(b.buffer());
00027 void * v = operand;
00028 std::memcpy(slot_p+0 , &o, sizeof(MessageLoggerQ::OpCode));
00029 std::memcpy(slot_p+sizeof(MessageLoggerQ::OpCode), &v, sizeof(void *));
00030 b.commit(buf_size);
00031 }
00032
00033 void
00034 ThreadQueue::
00035 consume( MessageLoggerQ::OpCode & opcode, void * & operand )
00036 {
00037 SingleConsumerQ::ConsumerBuffer b(m_buf);
00038 char * slot_p = static_cast<char *>(b.buffer());
00039 std::memcpy(&opcode , slot_p+0 , sizeof(MessageLoggerQ::OpCode));
00040 std::memcpy(&operand, slot_p+sizeof(MessageLoggerQ::OpCode), sizeof(void *));
00041 b.commit(buf_size);
00042 }
00043
00044
00045
00046
00047 }
00048 }