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" 28 #include "boost/date_time/posix_time/posix_time_types.hpp" 61 using namespace boost::posix_time;
67 <<
"Failed waiting for external process while setting up the process. Timed out after " <<
maxWaitInSeconds_ 77 template <
typename F,
typename FRETRY>
82 using namespace boost::posix_time;
84 bool shouldContinue =
true;
85 long long int retryCount = 0;
91 <<
"Failed waiting for external process while setting up the process. Timed out after " 97 shouldContinue =
false;
99 }
while (shouldContinue);
102 template <
typename F>
108 if (not
wait(
lock, iTrans, iTransitionID)) {
116 template <
typename F,
typename FRETRY>
122 if (not
wait(
lock, iTrans, iTransitionID)) {
126 bool shouldContinue =
true;
128 using namespace boost::posix_time;
134 shouldContinue =
false;
136 }
while (shouldContinue);
169 const unsigned long long*
ptr_;
175 return {*iPtr, iPtr};
182 bool wait(boost::interprocess::scoped_lock<boost::interprocess::named_mutex>&
lock,
184 unsigned long long iTransID);
185 bool wait(boost::interprocess::scoped_lock<boost::interprocess::named_mutex>&
lock);
186 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.
bool workerFinished() const noexcept
boost::interprocess::named_condition cndToMain_
const unsigned long long * ptr_
struct edm::shared_memory::ControllerChannel::SMORemover smRemover_
BufferInfo * fromWorkerBufferInfo_
bool shouldKeepEvent() const
bool wait(boost::interprocess::scoped_lock< boost::interprocess::named_mutex > &lock, edm::Transition iTrans, unsigned long long iTransID)
edm::Transition * transitionType_
unsigned int maxWaitInSeconds() const noexcept
std::string uniqueID() const
std::string const & sharedMemoryName() const
ConditionRemover cndToMainRemover_
BufferInfo * fromWorkerBufferInfo()
This can be used with ReadBuffer to keep Controller and Worker in sync.
unsigned long long * transitionID_
boost::interprocess::named_mutex mutex_
MutexRemover mutexRemover_
uint16_t mem[nChs][nEvts]
MutexRemover(std::string iName)
unsigned int maxWaitInSeconds_
CheckWorkerStatus initCheckWorkerStatus(unsigned long long *iPtr) const noexcept
std::string uniqueName(std::string iBase) const
const ControllerChannel & operator=(const ControllerChannel &)=delete
ConditionRemover(std::string iName)
BufferInfo * toWorkerBufferInfo_
boost::interprocess::named_condition cndFromMain_
ConditionRemover cndFromMainRemover_
ControllerChannel(std::string const &iName, int iID, unsigned int iMaxWaitInSeconds)
const unsigned long long initValue_
def remove(d, key, TELL=False)
boost::interprocess::managed_shared_memory managed_sm_
bool continueWait(boost::interprocess::scoped_lock< boost::interprocess::named_mutex > &lock)
static BufferInfo * bufferInfo(const char *iWhich, boost::interprocess::managed_shared_memory &mem)
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
SMORemover(const std::string &iName)
bool doTransition(F &&iF, edm::Transition iTrans, unsigned long long iTransitionID)
bool doTransitionWithRetry(F &&iF, FRETRY &&iRetry, edm::Transition iTrans, unsigned long long iTransitionID)