CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMEventProcessorResources.cc
Go to the documentation of this file.
1 // $Id: DQMEventProcessorResources.cc,v 1.5 2011/03/07 15:31:32 mommsen Exp $
3 
5 
6 namespace stor
7 {
9  requestsPending_(false),
10  requestsInProgress_(false)
11  {
13  }
14 
16  requestConfiguration(DQMProcessingParams const& params, boost::posix_time::time_duration const& timeoutValue)
17  {
18  boost::mutex::scoped_lock sl(requestsMutex_);
19 
21  requestedTimeout_ = timeoutValue;
22 
23  // A new configuration forces the store destruction and
24  // after the store is destroyed, end-of-run processing
25  // has nothing left to do. Thus, cancel these requests.
27  pendingRequests_.endOfRun = false;
29  requestsPending_ = true;
30  }
31 
33  {
34  boost::mutex::scoped_lock sl(requestsMutex_);
35 
36  // A end-of-run request does not change any other requests.
38  requestsPending_ = true;
39  }
40 
42  {
43  boost::mutex::scoped_lock sl(requestsMutex_);
44 
45  // The store destruction clears everything.
46  // Thus, cancel any other pending requests.
48  pendingRequests_.endOfRun = false;
50  requestsPending_ = true;
51  }
52 
54  getRequests(Requests& requests, DQMProcessingParams& params, boost::posix_time::time_duration& timeoutValue)
55  {
56  boost::mutex::scoped_lock sl(requestsMutex_);
57 
58  if (! requestsPending_) {return false;}
59 
60  requestsPending_ = false;
61 
62  requests = pendingRequests_;
64  timeoutValue = requestedTimeout_;
65 
67  requestsInProgress_ = true;
68 
69  return true;
70  }
71 
73  {
74  boost::mutex::scoped_lock sl(requestsMutex_);
76  {
77  requestsCondition_.wait(sl);
78  }
79  }
80 
82  {
83  boost::mutex::scoped_lock sl(requestsMutex_);
85  }
86 
88  {
89  boost::mutex::scoped_lock sl(requestsMutex_);
91  {
92  requestsCondition_.notify_one();
93  }
94  requestsInProgress_ = false;
95  }
96 
98  {
99  configuration = false;
100  endOfRun = false;
101  storeDestruction = false;
102  }
103 
104 } // namespace stor
105 
boost::posix_time::time_duration requestedTimeout_
bool getRequests(Requests &, DQMProcessingParams &, boost::posix_time::time_duration &timeoutValue)
void requestConfiguration(DQMProcessingParams const &, boost::posix_time::time_duration const &)