CMS 3D CMS Logo

Classes | Public Member Functions | Private Attributes

stor::DQMEventProcessorResources Class Reference

#include <DQMEventProcessorResources.h>

List of all members.

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 ( ) [inline, virtual]

Destructor.

Definition at line 46 of file DQMEventProcessorResources.h.

{}

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().

  {
    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 ( )
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);
      }
  }

Member Data Documentation

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().

Definition at line 97 of file DQMEventProcessorResources.h.

Referenced by requestsDone(), and waitForCompletion().