#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_ |
Container class for resources that are needed by the DQMEventProcessor and need to be accessed from multiple threads.
Definition at line 25 of file DQMEventProcessorResources.h.
stor::DQMEventProcessorResources::DQMEventProcessorResources | ( | ) |
Constructs a DQMEventProcessorResources instance.
Definition at line 8 of file DQMEventProcessorResources.cc.
References pendingRequests_, and stor::DQMEventProcessorResources::Requests::reset().
: requestsPending_(false), requestsInProgress_(false) { pendingRequests_.reset(); }
virtual stor::DQMEventProcessorResources::~DQMEventProcessorResources | ( | ) | [inline, virtual] |
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().
{ boost::mutex::scoped_lock sl(requestsMutex_); if (! requestsPending_) {return false;} requestsPending_ = false; requests = pendingRequests_; params = requestedDQMProcessingParams_; timeoutValue = requestedTimeout_; pendingRequests_.reset(); requestsInProgress_ = true; return true; }
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.
{ boost::mutex::scoped_lock sl(requestsMutex_); requestedDQMProcessingParams_ = params; requestedTimeout_ = timeoutValue; // A new configuration forces the store destruction and // after the store is destroyed, end-of-run processing // has nothing left to do. Thus, cancel these requests. pendingRequests_.configuration = true; pendingRequests_.endOfRun = false; pendingRequests_.storeDestruction = false; requestsPending_ = true; }
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_.
{ boost::mutex::scoped_lock sl(requestsMutex_); // A end-of-run request does not change any other requests. pendingRequests_.endOfRun = true; requestsPending_ = true; }
void stor::DQMEventProcessorResources::requestsDone | ( | ) |
Indicates that the requests were processed
Definition at line 87 of file DQMEventProcessorResources.cc.
References requestsCondition_, requestsInProgress_, and requestsMutex_.
{ boost::mutex::scoped_lock sl(requestsMutex_); if (requestsInProgress_) { requestsCondition_.notify_one(); } requestsInProgress_ = false; }
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_.
{ boost::mutex::scoped_lock sl(requestsMutex_); return (requestsPending_ || requestsInProgress_); }
void stor::DQMEventProcessorResources::requestStoreDestruction | ( | ) |
Requests that the DQMEventStore is emptied.
Definition at line 41 of file DQMEventProcessorResources.cc.
References stor::DQMEventProcessorResources::Requests::configuration, stor::DQMEventProcessorResources::Requests::endOfRun, pendingRequests_, requestsMutex_, requestsPending_, and stor::DQMEventProcessorResources::Requests::storeDestruction.
{ boost::mutex::scoped_lock sl(requestsMutex_); // The store destruction clears everything. // Thus, cancel any other pending requests. pendingRequests_.configuration = false; pendingRequests_.endOfRun = false; pendingRequests_.storeDestruction = true; requestsPending_ = true; }
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_.
{ boost::mutex::scoped_lock sl(requestsMutex_); if (requestsPending_ || requestsInProgress_) { requestsCondition_.wait(sl); } }
Definition at line 92 of file DQMEventProcessorResources.h.
Referenced by DQMEventProcessorResources(), getRequests(), requestConfiguration(), requestEndOfRun(), and requestStoreDestruction().
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] |
Definition at line 91 of file DQMEventProcessorResources.h.
Referenced by getRequests(), requestsDone(), requestsOngoing(), and waitForCompletion().
boost::mutex stor::DQMEventProcessorResources::requestsMutex_ [mutable, private] |
Definition at line 99 of file DQMEventProcessorResources.h.
Referenced by getRequests(), requestConfiguration(), requestEndOfRun(), requestsDone(), requestsOngoing(), requestStoreDestruction(), and waitForCompletion().
bool stor::DQMEventProcessorResources::requestsPending_ [private] |
Definition at line 90 of file DQMEventProcessorResources.h.
Referenced by getRequests(), requestConfiguration(), requestEndOfRun(), requestsOngoing(), requestStoreDestruction(), and waitForCompletion().