#include <DiskWriterResources.h>
Container class for resources that are needed by the DiskWriter and need to be accessed from multiple threads.
Definition at line 32 of file DiskWriterResources.h.
stor::DiskWriterResources::DiskWriterResources | ( | ) |
Constructs a DiskWriterResources instance.
Definition at line 8 of file DiskWriterResources.cc.
: configurationIsNeeded_(false), streamChangeIsNeeded_(false), fileClosingTestIsNeeded_(false), diskWriterIsBusy_(false), streamChangeInProgress_(false) { }
virtual stor::DiskWriterResources::~DiskWriterResources | ( | ) | [inline, virtual] |
bool stor::DiskWriterResources::isBusy | ( | ) |
Tests if the DiskWriter is currently busy..
Definition at line 107 of file DiskWriterResources.cc.
References diskWriterIsBusy_.
{ //boost::mutex::scoped_lock sl(generalMutex_); return diskWriterIsBusy_; }
void stor::DiskWriterResources::requestStreamConfiguration | ( | EvtStrConfigListPtr const | evtStrConfig, |
ErrStrConfigListPtr const | errStrConfig, | ||
DiskWritingParams const & | dwParams, | ||
unsigned int const & | runNumber, | ||
boost::posix_time::time_duration const & | timeoutValue | ||
) |
Requests that the DiskWriter streams be configured with the specified configurations. Also allows new DiskWritingParams, run number and dequeue timeout values to be specified. Existing stream configurations will be discarded.
Definition at line 18 of file DiskWriterResources.cc.
References ExpressReco_HICollisions_FallBack::runNumber.
{ boost::mutex::scoped_lock sl(streamChangeMutex_); requestedEventStreamConfig_ = evtStrConfig; requestedErrorStreamConfig_ = errStrConfig; requestedDiskWritingParams_ = dwParams; requestedRunNumber_ = runNumber; requestedTimeout_ = timeoutValue; configurationIsNeeded_ = true; streamChangeIsNeeded_ = true; }
void stor::DiskWriterResources::requestStreamDestruction | ( | ) |
Requests that the DiskWriter streams be destroyed. Any pending stream configuraton request will be cancelled.
Definition at line 37 of file DiskWriterResources.cc.
References configurationIsNeeded_, streamChangeIsNeeded_, and streamChangeMutex_.
{ boost::mutex::scoped_lock sl(streamChangeMutex_); configurationIsNeeded_ = false; streamChangeIsNeeded_ = true; }
void stor::DiskWriterResources::setBusy | ( | bool | isBusyFlag | ) |
Sets the DiskWriter "busy" status to the specified state.
Definition at line 101 of file DiskWriterResources.cc.
References diskWriterIsBusy_.
{ //boost::mutex::scoped_lock sl(generalMutex_); diskWriterIsBusy_ = isBusyFlag; }
void stor::DiskWriterResources::streamChangeDone | ( | ) |
Indicates that the stream configuration change is done.
Definition at line 91 of file DiskWriterResources.cc.
References streamChangeCondition_, streamChangeInProgress_, and streamChangeMutex_.
{ boost::mutex::scoped_lock sl(streamChangeMutex_); if (streamChangeInProgress_) { streamChangeCondition_.notify_one(); } streamChangeInProgress_ = false; }
bool stor::DiskWriterResources::streamChangeOngoing | ( | ) | [virtual] |
Returns true when a stream configuration change is requested or in progress.
Definition at line 85 of file DiskWriterResources.cc.
References streamChangeInProgress_, streamChangeIsNeeded_, and streamChangeMutex_.
{ boost::mutex::scoped_lock sl(streamChangeMutex_); return (streamChangeIsNeeded_ || streamChangeInProgress_); }
bool stor::DiskWriterResources::streamChangeRequested | ( | bool & | doConfig, |
EvtStrConfigListPtr & | evtStrConfig, | ||
ErrStrConfigListPtr & | errStrConfig, | ||
DiskWritingParams & | dwParams, | ||
unsigned int & | runNumber, | ||
boost::posix_time::time_duration & | timeoutValue | ||
) |
Checks if a request has been made to change the stream configuration in the DiskWriter streams *and* clears any pending request. Existing streams are purged. If doConfig is true, the supplied new configurations, new run number, and dequeue timeout value should be used to configure a new set of DiskWriter streams.
Definition at line 45 of file DiskWriterResources.cc.
{ boost::mutex::scoped_lock sl(streamChangeMutex_); if (! streamChangeIsNeeded_) {return false;} streamChangeIsNeeded_ = false; doConfig = configurationIsNeeded_; if (configurationIsNeeded_) { configurationIsNeeded_ = false; evtStrConfig = requestedEventStreamConfig_; errStrConfig = requestedErrorStreamConfig_; dwParams = requestedDiskWritingParams_; runNumber = requestedRunNumber_; timeoutValue = requestedTimeout_; } streamChangeInProgress_ = true; return true; }
void stor::DiskWriterResources::waitForStreamChange | ( | ) | [virtual] |
Waits until a requested stream configuration change has been completed.
Definition at line 76 of file DiskWriterResources.cc.
References streamChangeCondition_, streamChangeInProgress_, streamChangeIsNeeded_, and streamChangeMutex_.
{ boost::mutex::scoped_lock sl(streamChangeMutex_); if (streamChangeIsNeeded_ || streamChangeInProgress_) { streamChangeCondition_.wait(sl); } }
bool stor::DiskWriterResources::configurationIsNeeded_ [private] |
Definition at line 111 of file DiskWriterResources.h.
Referenced by requestStreamDestruction().
bool stor::DiskWriterResources::diskWriterIsBusy_ [private] |
Definition at line 114 of file DiskWriterResources.h.
bool stor::DiskWriterResources::fileClosingTestIsNeeded_ [private] |
Definition at line 113 of file DiskWriterResources.h.
Definition at line 118 of file DiskWriterResources.h.
Definition at line 117 of file DiskWriterResources.h.
Definition at line 116 of file DiskWriterResources.h.
unsigned int stor::DiskWriterResources::requestedRunNumber_ [private] |
Definition at line 119 of file DiskWriterResources.h.
boost::posix_time::time_duration stor::DiskWriterResources::requestedTimeout_ [private] |
Definition at line 120 of file DiskWriterResources.h.
boost::condition stor::DiskWriterResources::streamChangeCondition_ [private] |
Definition at line 123 of file DiskWriterResources.h.
Referenced by streamChangeDone(), and waitForStreamChange().
bool stor::DiskWriterResources::streamChangeInProgress_ [private] |
Definition at line 122 of file DiskWriterResources.h.
Referenced by streamChangeDone(), streamChangeOngoing(), and waitForStreamChange().
bool stor::DiskWriterResources::streamChangeIsNeeded_ [private] |
Definition at line 112 of file DiskWriterResources.h.
Referenced by requestStreamDestruction(), streamChangeOngoing(), and waitForStreamChange().
boost::mutex stor::DiskWriterResources::streamChangeMutex_ [mutable, private] |
Definition at line 125 of file DiskWriterResources.h.
Referenced by requestStreamDestruction(), streamChangeDone(), streamChangeOngoing(), and waitForStreamChange().