|
|
Go to the documentation of this file. 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"
57 using namespace boost::interprocess;
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>
78 using namespace boost::interprocess;
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>
103 using namespace boost::interprocess;
107 if (not
wait(
lock, iTrans, iTransitionID)) {
115 template <
typename F,
typename FRETRY>
117 using namespace boost::interprocess;
121 if (not
wait(
lock, iTrans, iTransitionID)) {
125 bool shouldContinue =
true;
127 using namespace boost::posix_time;
133 shouldContinue =
false;
135 }
while (shouldContinue);
149 using namespace boost::interprocess;
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);
boost::interprocess::named_condition cndToMain_
edm::Transition * transitionType_
unsigned int maxWaitInSeconds() const noexcept
BufferInfo * toWorkerBufferInfo()
This can be used with WriteBuffer to keep Controller and Worker in sync.
boost::interprocess::managed_shared_memory managed_sm_
bool wait(boost::interprocess::scoped_lock< boost::interprocess::named_mutex > &lock, edm::Transition iTrans, unsigned long long iTransID)
const unsigned long long initValue_
CheckWorkerStatus initCheckWorkerStatus(unsigned long long *iPtr) const noexcept
std::string uniqueName(std::string iBase) const
bool continueWait(boost::interprocess::scoped_lock< boost::interprocess::named_mutex > &lock)
std::string uniqueID() const
uint16_t mem[nChs][nEvts]
BufferInfo * fromWorkerBufferInfo_
unsigned long long * transitionID_
bool shouldKeepEvent() const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
bool workerFinished() const noexcept
boost::interprocess::named_condition cndFromMain_
BufferInfo * toWorkerBufferInfo_
static BufferInfo * bufferInfo(const char *iWhich, boost::interprocess::managed_shared_memory &mem)
BufferInfo * fromWorkerBufferInfo()
This can be used with ReadBuffer to keep Controller and Worker in sync.
ControllerChannel(std::string const &iName, int iID, unsigned int iMaxWaitInSeconds)
bool doTransitionWithRetry(F &&iF, FRETRY &&iRetry, edm::Transition iTrans, unsigned long long iTransitionID)
std::string const & sharedMemoryName() const
const unsigned long long * ptr_
boost::interprocess::named_mutex mutex_
const ControllerChannel & operator=(const ControllerChannel &)=delete
unsigned int maxWaitInSeconds_
void setupWorkerWithRetry(F &&iF, FRETRY &&iRetry)
bool doTransition(F &&iF, edm::Transition iTrans, unsigned long long iTransitionID)