1 #ifndef FWCore_SharedMemory_ControllerChannel_h 2 #define FWCore_SharedMemory_ControllerChannel_h 24 #include "boost/interprocess/managed_shared_memory.hpp" 25 #include "boost/interprocess/sync/named_mutex.hpp" 26 #include "boost/interprocess/sync/named_condition.hpp" 27 #include "boost/interprocess/sync/scoped_lock.hpp" 60 using namespace boost::posix_time;
66 <<
"Failed waiting for external process while setting up the process. Timed out after " <<
maxWaitInSeconds_ 76 template <
typename F,
typename FRETRY>
81 using namespace boost::posix_time;
83 bool shouldContinue =
true;
84 long long int retryCount = 0;
90 <<
"Failed waiting for external process while setting up the process. Timed out after " 96 shouldContinue =
false;
98 }
while (shouldContinue);
101 template <
typename F>
107 if (not
wait(lock, iTrans, iTransitionID)) {
115 template <
typename F,
typename FRETRY>
121 if (not
wait(lock, iTrans, iTransitionID)) {
125 bool shouldContinue =
true;
127 using namespace boost::posix_time;
133 shouldContinue =
false;
135 }
while (shouldContinue);
168 const unsigned long long*
ptr_;
174 return {*iPtr, iPtr};
181 bool wait(boost::interprocess::scoped_lock<boost::interprocess::named_mutex>&
lock,
183 unsigned long long iTransID);
184 bool wait(boost::interprocess::scoped_lock<boost::interprocess::named_mutex>& lock);
185 bool continueWait(boost::interprocess::scoped_lock<boost::interprocess::named_mutex>& lock);
void setupWorkerWithRetry(F &&iF, FRETRY &&iRetry)
BufferInfo * toWorkerBufferInfo()
This can be used with WriteBuffer to keep Controller and Worker in sync.
boost::interprocess::named_condition cndToMain_
const unsigned long long * ptr_
BufferInfo * fromWorkerBufferInfo_
bool wait(boost::interprocess::scoped_lock< boost::interprocess::named_mutex > &lock, edm::Transition iTrans, unsigned long long iTransID)
edm::Transition * transitionType_
BufferInfo * fromWorkerBufferInfo()
This can be used with ReadBuffer to keep Controller and Worker in sync.
unsigned long long * transitionID_
boost::interprocess::named_mutex mutex_
std::string const & sharedMemoryName() const
uint16_t mem[nChs][nEvts]
unsigned int maxWaitInSeconds_
const ControllerChannel & operator=(const ControllerChannel &)=delete
unsigned int maxWaitInSeconds() const
BufferInfo * toWorkerBufferInfo_
boost::interprocess::named_condition cndFromMain_
ControllerChannel(std::string const &iName, int iID, unsigned int iMaxWaitInSeconds)
const unsigned long long initValue_
boost::interprocess::managed_shared_memory managed_sm_
bool workerFinished() const
std::string uniqueName(std::string iBase) const
bool continueWait(boost::interprocess::scoped_lock< boost::interprocess::named_mutex > &lock)
CheckWorkerStatus initCheckWorkerStatus(unsigned long long *iPtr) const
static BufferInfo * bufferInfo(const char *iWhich, boost::interprocess::managed_shared_memory &mem)
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
std::string uniqueID() const
bool doTransition(F &&iF, edm::Transition iTrans, unsigned long long iTransitionID)
bool doTransitionWithRetry(F &&iF, FRETRY &&iRetry, edm::Transition iTrans, unsigned long long iTransitionID)
bool shouldKeepEvent() const