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  void addConsumer(PoolConsumer&, uint64_t poolThreadAffinityIn = 0xfffffffffffffffful);
12  uint32_t consumerSize() const;
13  void start(uint16_t threadCount, uint64_t cpuAffinityMask = 0
14  , bool thatIsAll = true);
15  void startAll(uint64_t cpuAffinityMask = 0);
16  void startThruRecycling(uint16_t threadCount, uint64_t cpuAffinityMask = 0);
17  void runOnce(uint16_t threadSerialNumber);
18  void stop();
19  void join();
20  static
21  std::shared_ptr<PoolT> create(Buffer& lfb, uint32_t maxConsumerSize) {
22  return std::shared_ptr<PoolT>(
23  new PoolT(lfb, maxConsumerSize)
24  );
25  }
26 
27 private:
28  PoolT(Buffer&, uint32_t);
29  void* impl_;
30 };
31 
32 }}
Definition: PoolConsumer.hpp:13
Definition: Client.hpp:11
Definition: PoolT.hpp:10