CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ToDqm.cc
Go to the documentation of this file.
2 //#include "FWCore/ServiceRegistry/interface/Service.h"
3 
4 
7 {
8  if(instance_ == 0) instance_ = new xmas2dqm::wse::ToDqm(); return instance_;
9 }
10 
11 xmas2dqm::wse::ToDqm::ToDqm() : BSem_(toolbox::BSem::FULL),messageCount_(0)
12 {
13  //std::cout << "ToDqm constructor called.... " << std::endl;
14  pthread_mutex_init(&LASmutex_,NULL);
15  pthread_cond_init(&more_,NULL);
16  pthread_cond_init(&less_,NULL);
17 
18 
19 }
20 
22 {
23 
24  //The implementation has detected an attempt to destroy the object referenced by mutex while
25  //it is locked or referenced (for example, while being used in a pthread_cond_timedwait() or pthread_cond_wait()) by another thread.
26 
27  //pthread_mutex_unlock(&mymutex_);
28  //pthread_mutex_destroy(&mymutex_);
29 }
30 
31 
33  (
34  const std::string& flashListName,
35  const std::string& originator,
36  const std::string& tag,
37  /*xdata::Table::Reference table*/
38  xdata::Table *table
39  )
41 {
42 
43  std::cout << "inside digest...." << std::endl;
44 
45  std::map<std::string, std::string, std::less<std::string> >::iterator i;
46 
47  //std::cout<< "ToDQM->digest : before BSem_.take();" << std::endl;
48  //BSem_.take();
49  //acquire the mutex - protect access to the queue
50  //pthread_mutex_lock(&mymutex_);
51 
52  //check if the queue is full and wait (a signal that informs that an element has been poped)
53  // until there is 'space' in the queue
54  //while (QTable_.size() >= Qsize_max)
55  //{
56  //pthread_cond_wait(&less_, &mymutex_);
57  //}
58 
59  //push new element to the queue of LAS data
60  //QTable_.push(table);
61  MemoryTable_.push(table);
62 
63  //MemoryTable_.push(mtable);
64 
65  //std::cout << "ToDQM->digest : Queue size = " << QTable_.size() << std::endl;
66 
67  //std::cout<< "ToDQM->digest : before BSem_.give();" << std::endl;
68 
69  //signal that a new element has been inserted
70  //pthread_cond_signal(&more_);
71 
72  //allow access to the queue
73  //pthread_mutex_unlock(&mymutex_);
74  //BSem_.give();
75 
76  messageCount_++;
77 
78 }
79 
81 {
82  std::cout << "free_memory: before MemoryTable.front()" << std::endl;
83 
84  xdata::Table * temp = MemoryTable_.front();
85  delete temp;
86 
87  //MemoryTable_.front()->xdata::Table::~Table() ;
88 
89  //MemoryTable_.front()->clear();
90 
91 
92  std::cout << "free_memory: before MemoryTable.pop()" << std::endl;
93  MemoryTable_.pop();
94 
95  std::cout << "free_memory: returning...." << std::endl;
96 }
97 
list table
Definition: asciidump.py:386
int i
Definition: DBlmapReader.cc:9
pthread_mutex_t LASmutex_
Definition: ToDqm.h:73
void digest(const std::string &flashListName, const std::string &originator, const std::string &tag, xdata::Table *table)
Definition: ToDqm.cc:33
#define NULL
Definition: scimark2.h:8
pthread_cond_t more_
Definition: ToDqm.h:76
pthread_cond_t less_
Definition: ToDqm.h:79
static ToDqm * instance()
Definition: ToDqm.cc:6
static ToDqm * instance_
Definition: ToDqm.h:86
void free_memory()
Definition: ToDqm.cc:80
tuple cout
Definition: gather_cfg.py:121