FairMQ  1.3.7
C++ Message Passing Framework
Region.h
1 /********************************************************************************
2 * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3 * *
4 * This software is distributed under the terms of the *
5 * GNU Lesser General Public Licence (LGPL) version 3, *
6 * copied verbatim in the file "LICENSE" *
7 ********************************************************************************/
15 #ifndef FAIR_MQ_SHMEM_REGION_H_
16 #define FAIR_MQ_SHMEM_REGION_H_
17 
18 #include "FairMQLogger.h"
19 #include "FairMQUnmanagedRegion.h"
20 
21 #include <fairmq/Tools.h>
22 
23 #include <boost/interprocess/managed_shared_memory.hpp>
24 #include <boost/interprocess/ipc/message_queue.hpp>
25 
26 #include <thread>
27 #include <unordered_map>
28 
29 namespace fair
30 {
31 namespace mq
32 {
33 namespace shmem
34 {
35 
36 class Manager;
37 
38 struct Region
39 {
40  Region(Manager& manager, uint64_t id, uint64_t size, bool remote, FairMQRegionCallback callback = nullptr);
41 
42  Region() = delete;
43 
44  Region(const Region&) = default;
45  Region(Region&&) = default;
46 
47  void StartReceivingAcks();
48  void ReceiveAcks();
49 
50  ~Region();
51 
52  Manager& fManager;
53  bool fRemote;
54  bool fStop;
55  std::string fName;
56  std::string fQueueName;
57  boost::interprocess::shared_memory_object fShmemObject;
58  boost::interprocess::mapped_region fRegion;
59  std::unique_ptr<boost::interprocess::message_queue> fQueue;
60  std::thread fWorker;
61  FairMQRegionCallback fCallback;
62 };
63 
64 } // namespace shmem
65 } // namespace mq
66 } // namespace fair
67 
68 #endif /* FAIR_MQ_SHMEM_REGION_H_ */
Definition: Manager.h:38
Definition: Region.h:38
Tools for interfacing containers to the transport via polymorphic allocators.
Definition: DeviceRunner.h:23

privacy