#include <ControllerChannel.h>
Classes | |
struct | CheckWorkerStatus |
Public Member Functions | |
ControllerChannel (std::string const &iName, int iID, unsigned int iMaxWaitInSeconds) | |
ControllerChannel (const ControllerChannel &)=delete | |
ControllerChannel (ControllerChannel &&)=delete | |
template<typename F > | |
bool | doTransition (F &&iF, edm::Transition iTrans, unsigned long long iTransitionID) |
template<typename F , typename FRETRY > | |
bool | doTransitionWithRetry (F &&iF, FRETRY &&iRetry, edm::Transition iTrans, unsigned long long iTransitionID) |
BufferInfo * | fromWorkerBufferInfo () |
This can be used with ReadBuffer to keep Controller and Worker in sync. More... | |
unsigned int | maxWaitInSeconds () const |
const ControllerChannel & | operator= (const ControllerChannel &)=delete |
const ControllerChannel & | operator= (ControllerChannel &&)=delete |
template<typename F > | |
void | setupWorker (F &&iF) |
template<typename F , typename FRETRY > | |
void | setupWorkerWithRetry (F &&iF, FRETRY &&iRetry) |
std::string const & | sharedMemoryName () const |
bool | shouldKeepEvent () const |
void | stopWorker () |
BufferInfo * | toWorkerBufferInfo () |
This can be used with WriteBuffer to keep Controller and Worker in sync. More... | |
std::string | uniqueID () const |
~ControllerChannel () | |
Private Member Functions | |
bool | continueWait (boost::interprocess::scoped_lock< boost::interprocess::named_mutex > &lock) |
CheckWorkerStatus | initCheckWorkerStatus (unsigned long long *iPtr) const |
std::string | uniqueName (std::string iBase) const |
bool | wait (boost::interprocess::scoped_lock< boost::interprocess::named_mutex > &lock, edm::Transition iTrans, unsigned long long iTransID) |
bool | wait (boost::interprocess::scoped_lock< boost::interprocess::named_mutex > &lock) |
Static Private Member Functions | |
static BufferInfo * | bufferInfo (const char *iWhich, boost::interprocess::managed_shared_memory &mem) |
Private Attributes | |
boost::interprocess::named_condition | cndFromMain_ |
boost::interprocess::named_condition | cndToMain_ |
BufferInfo * | fromWorkerBufferInfo_ |
int | id_ |
bool * | keepEvent_ |
boost::interprocess::managed_shared_memory | managed_sm_ |
unsigned int | maxWaitInSeconds_ |
boost::interprocess::named_mutex | mutex_ |
std::string | smName_ |
bool * | stop_ |
BufferInfo * | toWorkerBufferInfo_ |
unsigned long long * | transitionID_ |
edm::Transition * | transitionType_ |
Definition at line 37 of file ControllerChannel.h.
ControllerChannel::ControllerChannel | ( | std::string const & | iName, |
int | iID, | ||
unsigned int | iMaxWaitInSeconds | ||
) |
iName is used as the base for the shared memory name. The full name uses iID as well as getpid() to create the value sharedMemoryName(). iID allows multiple ControllChannels to use the same base name iName.
Definition at line 34 of file ControllerChannel.cc.
References bufferInfo(), cndFromMain_, cndToMain_, fromWorkerBufferInfo_, edm::shared_memory::channel_names::kConditionFromMain, edm::shared_memory::channel_names::kConditionToMain, keepEvent_, edm::shared_memory::channel_names::kFromWorkerBufferInfo, edm::shared_memory::channel_names::kKeepEvent, edm::shared_memory::channel_names::kMutex, edm::shared_memory::channel_names::kStop, edm::shared_memory::channel_names::kToWorkerBufferInfo, edm::shared_memory::channel_names::kTransitionID, edm::shared_memory::channel_names::kTransitionType, managed_sm_, maxWaitInSeconds_, mutex_, edm::NumberOfTransitions, smName_, stop_, toWorkerBufferInfo_, transitionID_, transitionType_, and uniqueName().
ControllerChannel::~ControllerChannel | ( | ) |
Definition at line 60 of file ControllerChannel.cc.
References edm::shared_memory::channel_names::kConditionFromMain, edm::shared_memory::channel_names::kConditionToMain, edm::shared_memory::channel_names::kFromWorkerBufferInfo, edm::shared_memory::channel_names::kKeepEvent, edm::shared_memory::channel_names::kMutex, edm::shared_memory::channel_names::kStop, edm::shared_memory::channel_names::kToWorkerBufferInfo, edm::shared_memory::channel_names::kTransitionID, edm::shared_memory::channel_names::kTransitionType, managed_sm_, MatrixUtil::remove(), and uniqueName().
|
delete |
|
delete |
|
staticprivate |
Definition at line 137 of file ControllerChannel.cc.
References findQualityFiles::v.
Referenced by ControllerChannel(), and initCheckWorkerStatus().
|
private |
Definition at line 116 of file ControllerChannel.cc.
References cndToMain_, initCheckWorkerStatus(), maxWaitInSeconds_, seconds(), and transitionID_.
Referenced by doTransitionWithRetry(), and initCheckWorkerStatus().
|
inline |
Definition at line 102 of file ControllerChannel.h.
References CommonMethods::lock(), mutex_, and wait().
|
inline |
Definition at line 116 of file ControllerChannel.h.
References continueWait(), CommonMethods::lock(), mutex_, and wait().
|
inline |
This can be used with ReadBuffer to keep Controller and Worker in sync.
Definition at line 145 of file ControllerChannel.h.
References fromWorkerBufferInfo_.
|
inlineprivate |
Definition at line 173 of file ControllerChannel.h.
References bufferInfo(), continueWait(), CommonMethods::lock(), mem, AlCaHLTBitMon_QueryRunRegistry::string, uniqueName(), and wait().
Referenced by continueWait(), and uniqueName().
|
inline |
|
delete |
|
delete |
|
inline |
setupWorker must be called only once and done before any calls to doTransition. The functor iF should setup values associated with shared memory use, such as manipulating the value from toWorkerBufferInfo(). The call to setupWorker proper synchronizes the Controller and Worker processes.
Definition at line 56 of file ControllerChannel.h.
References Exception, CommonMethods::lock(), maxWaitInSeconds_, mutex_, stop_, and wait().
|
inline |
setupWorkerWithRetry works just like setupWorker except it gives a way to continue waiting. The functor iRetry should return true if, after a timeout, the code should continue to wait.
Definition at line 77 of file ControllerChannel.h.
References Exception, CommonMethods::lock(), maxWaitInSeconds_, mutex_, stop_, and wait().
|
inline |
|
inline |
|
inline |
Definition at line 147 of file ControllerChannel.h.
References cndFromMain_, CommonMethods::lock(), mutex_, and stop_.
|
inline |
This can be used with WriteBuffer to keep Controller and Worker in sync.
Definition at line 143 of file ControllerChannel.h.
References toWorkerBufferInfo_.
|
inline |
|
private |
Definition at line 76 of file ControllerChannel.cc.
References cndFromMain_, cndToMain_, id_, initCheckWorkerStatus(), CommonMethods::lock(), maxWaitInSeconds_, sysUtil::pid, seconds(), transitionID_, transitionType_, and wait().
Referenced by ControllerChannel(), initCheckWorkerStatus(), uniqueID(), and ~ControllerChannel().
|
private |
Referenced by doTransition(), doTransitionWithRetry(), initCheckWorkerStatus(), setupWorker(), setupWorkerWithRetry(), and uniqueName().
|
private |
|
private |
Definition at line 196 of file ControllerChannel.h.
Referenced by ControllerChannel(), stopWorker(), and uniqueName().
|
private |
Definition at line 198 of file ControllerChannel.h.
Referenced by continueWait(), ControllerChannel(), and uniqueName().
|
private |
Definition at line 193 of file ControllerChannel.h.
Referenced by ControllerChannel(), and fromWorkerBufferInfo().
|
private |
Definition at line 188 of file ControllerChannel.h.
Referenced by uniqueName().
|
private |
Definition at line 203 of file ControllerChannel.h.
Referenced by ControllerChannel(), and shouldKeepEvent().
|
private |
Definition at line 191 of file ControllerChannel.h.
Referenced by ControllerChannel(), and ~ControllerChannel().
|
private |
Definition at line 189 of file ControllerChannel.h.
Referenced by continueWait(), ControllerChannel(), maxWaitInSeconds(), setupWorker(), setupWorkerWithRetry(), and uniqueName().
|
private |
Definition at line 195 of file ControllerChannel.h.
Referenced by ControllerChannel(), doTransition(), doTransitionWithRetry(), setupWorker(), setupWorkerWithRetry(), and stopWorker().
|
private |
Definition at line 190 of file ControllerChannel.h.
Referenced by ControllerChannel(), and sharedMemoryName().
|
private |
Definition at line 202 of file ControllerChannel.h.
Referenced by ControllerChannel(), setupWorker(), setupWorkerWithRetry(), and stopWorker().
|
private |
Definition at line 192 of file ControllerChannel.h.
Referenced by ControllerChannel(), and toWorkerBufferInfo().
|
private |
Definition at line 201 of file ControllerChannel.h.
Referenced by continueWait(), ControllerChannel(), and uniqueName().
|
private |
Definition at line 200 of file ControllerChannel.h.
Referenced by ControllerChannel(), and uniqueName().