File indexing completed on 2024-04-06 12:13:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include <cassert>
0015
0016
0017 #include "FWCore/SharedMemory/interface/WorkerChannel.h"
0018 #include "FWCore/SharedMemory/interface/channel_names.h"
0019
0020
0021
0022
0023 using namespace edm::shared_memory;
0024 using namespace boost::interprocess;
0025
0026 namespace {
0027 std::string unique_name(std::string iBase, std::string_view ID) {
0028 iBase.append(ID);
0029 return iBase;
0030 }
0031 }
0032
0033
0034
0035
0036
0037
0038
0039
0040 WorkerChannel::WorkerChannel(std::string const& iName, const std::string& iUniqueID)
0041 : managed_shm_{open_only, iName.c_str()},
0042 mutex_{open_only, unique_name(channel_names::kMutex, iUniqueID).c_str()},
0043 cndFromController_{open_only, unique_name(channel_names::kConditionFromMain, iUniqueID).c_str()},
0044 stop_{managed_shm_.find<bool>(channel_names::kStop).first},
0045 transitionType_{managed_shm_.find<edm::Transition>(channel_names::kTransitionType).first},
0046 transitionID_{managed_shm_.find<unsigned long long>(channel_names::kTransitionID).first},
0047 toWorkerBufferInfo_{managed_shm_.find<BufferInfo>(channel_names::kToWorkerBufferInfo).first},
0048 fromWorkerBufferInfo_{managed_shm_.find<BufferInfo>(channel_names::kFromWorkerBufferInfo).first},
0049 cndToController_{open_only, unique_name(channel_names::kConditionToMain, iUniqueID).c_str()},
0050 keepEvent_{managed_shm_.find<bool>(channel_names::kKeepEvent).first},
0051 lock_{mutex_} {
0052 assert(stop_);
0053 assert(transitionType_);
0054 assert(transitionID_);
0055 assert(toWorkerBufferInfo_);
0056 assert(fromWorkerBufferInfo_);
0057 }
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069