CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Attributes
stor::DQMEventProcessorResources Class Reference

#include <DQMEventProcessorResources.h>

Classes

struct  Requests
 

Public Member Functions

 DQMEventProcessorResources ()
 
bool getRequests (Requests &, DQMProcessingParams &, boost::posix_time::time_duration &timeoutValue)
 
void requestConfiguration (DQMProcessingParams const &, boost::posix_time::time_duration const &)
 
void requestEndOfRun ()
 
void requestsDone ()
 
virtual bool requestsOngoing ()
 
void requestStoreDestruction ()
 
virtual void waitForCompletion ()
 
virtual ~DQMEventProcessorResources ()
 

Private Attributes

Requests pendingRequests_
 
DQMProcessingParams requestedDQMProcessingParams_
 
boost::posix_time::time_duration requestedTimeout_
 
boost::condition requestsCondition_
 
bool requestsInProgress_
 
boost::mutex requestsMutex_
 
bool requestsPending_
 

Detailed Description

Container class for resources that are needed by the DQMEventProcessor and need to be accessed from multiple threads.

Author:
mommsen
Revision:
1.5
Date:
2011/03/07 15:31:31

Definition at line 25 of file DQMEventProcessorResources.h.

Constructor & Destructor Documentation

stor::DQMEventProcessorResources::DQMEventProcessorResources ( )
virtual stor::DQMEventProcessorResources::~DQMEventProcessorResources ( )
inlinevirtual

Destructor.

Definition at line 46 of file DQMEventProcessorResources.h.

46 {}

Member Function Documentation

bool stor::DQMEventProcessorResources::getRequests ( Requests requests,
DQMProcessingParams params,
boost::posix_time::time_duration &  timeoutValue 
)

Checks if a request has been made and clears any pending request. Supplies the new DQMProcessingParams and a new dequeue timeout value if a new configuration is requested.

Definition at line 54 of file DQMEventProcessorResources.cc.

References pendingRequests_, requestedDQMProcessingParams_, requestedTimeout_, requestsInProgress_, requestsMutex_, requestsPending_, and stor::DQMEventProcessorResources::Requests::reset().

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  }
boost::posix_time::time_duration requestedTimeout_
void stor::DQMEventProcessorResources::requestConfiguration ( DQMProcessingParams const &  params,
boost::posix_time::time_duration const &  timeoutValue 
)

Requests that the DQMEventProcessor be configured with the specified DQMProcessingParams. Also allows a new dequeue timeout value to be specified.

Definition at line 16 of file DQMEventProcessorResources.cc.

References stor::DQMEventProcessorResources::Requests::configuration, stor::DQMEventProcessorResources::Requests::endOfRun, pendingRequests_, requestedDQMProcessingParams_, requestedTimeout_, requestsMutex_, requestsPending_, and stor::DQMEventProcessorResources::Requests::storeDestruction.

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  }
boost::posix_time::time_duration requestedTimeout_
void stor::DQMEventProcessorResources::requestEndOfRun ( )

Requests the end-of-run processing

Definition at line 32 of file DQMEventProcessorResources.cc.

References stor::DQMEventProcessorResources::Requests::endOfRun, pendingRequests_, requestsMutex_, and requestsPending_.

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  }
void stor::DQMEventProcessorResources::requestsDone ( )

Indicates that the requests were processed

Definition at line 87 of file DQMEventProcessorResources.cc.

References requestsCondition_, requestsInProgress_, and requestsMutex_.

88  {
89  boost::mutex::scoped_lock sl(requestsMutex_);
91  {
92  requestsCondition_.notify_one();
93  }
94  requestsInProgress_ = false;
95  }
bool stor::DQMEventProcessorResources::requestsOngoing ( )
virtual

Returns true when requests are pending or being processed

Definition at line 81 of file DQMEventProcessorResources.cc.

References requestsInProgress_, requestsMutex_, and requestsPending_.

void stor::DQMEventProcessorResources::requestStoreDestruction ( )
void stor::DQMEventProcessorResources::waitForCompletion ( )
virtual

Waits until the requests have been completed.

Definition at line 72 of file DQMEventProcessorResources.cc.

References requestsCondition_, requestsInProgress_, requestsMutex_, and requestsPending_.

Member Data Documentation

Requests stor::DQMEventProcessorResources::pendingRequests_
private
DQMProcessingParams stor::DQMEventProcessorResources::requestedDQMProcessingParams_
private

Definition at line 94 of file DQMEventProcessorResources.h.

Referenced by getRequests(), and requestConfiguration().

boost::posix_time::time_duration stor::DQMEventProcessorResources::requestedTimeout_
private

Definition at line 95 of file DQMEventProcessorResources.h.

Referenced by getRequests(), and requestConfiguration().

boost::condition stor::DQMEventProcessorResources::requestsCondition_
private

Definition at line 97 of file DQMEventProcessorResources.h.

Referenced by requestsDone(), and waitForCompletion().

bool stor::DQMEventProcessorResources::requestsInProgress_
private
boost::mutex stor::DQMEventProcessorResources::requestsMutex_
mutableprivate
bool stor::DQMEventProcessorResources::requestsPending_
private