hmbdc
simplify-high-performance-messaging-programming
PoolT.hpp
1 #include "hmbdc/Copyright.hpp"
2 #pragma once
3 #include "hmbdc/pattern/PoolConsumer.hpp"
4 #include <stdint.h>
5 #include <memory>
6 
7 namespace hmbdc { namespace pattern {
8 
9 template <typename Buffer>
10 struct PoolT {
11  using ptr = std::shared_ptr<PoolT<Buffer>>;
12  void addConsumer(PoolConsumer&, uint64_t poolThreadAffinityIn = 0xfffffffffffffffful);
13  uint32_t consumerSize() const;
14  void start(uint16_t threadCount, uint64_t cpuAffinityMask = 0
15  , bool thatIsAll = true);
16  void startAll(uint64_t cpuAffinityMask = 0);
17  void startThruRecycling(uint16_t threadCount, uint64_t cpuAffinityMask = 0);
18  void runOnce(uint16_t threadSerialNumber);
19  void stop();
20  void join();
21  static
22  std::shared_ptr<PoolT> create(Buffer& lfb, uint32_t maxConsumerSize) {
23  return std::shared_ptr<PoolT>(
24  new PoolT(lfb, maxConsumerSize)
25  );
26  }
27  ~PoolT();
28 
29 private:
30  PoolT(Buffer&, uint32_t);
31  void* impl_;
32 };
33 
34 }}
Definition: PoolConsumer.hpp:13
Definition: Base.hpp:12
Definition: PoolT.hpp:10