1 #include "hmbdc/Copyright.hpp" 4 #include "hmbdc/app/Client.hpp" 5 #include "hmbdc/app/Message.hpp" 7 #include "hmbdc/pattern/PoolT.hpp" 8 #include "hmbdc/pattern/PoolMinus.hpp" 9 #include "hmbdc/pattern/LockFreeBufferT.hpp" 10 #include "hmbdc/pattern/MonoLockFreeBuffer.hpp" 12 #include "hmbdc/os/Thread.hpp" 13 #include "hmbdc/os/Allocators.hpp" 14 #include "hmbdc/time/Timers.hpp" 17 #include <type_traits> 21 namespace hmbdc {
namespace app {
namespace context_detail {
25 template <
typename CcClient>
28 template <
typename U = CcClient>
30 ,
size_t* pDispStartCount
31 ,
typename std::enable_if<std::is_base_of<time::TimerManager, U>::value>::type* =
nullptr)
35 template <
typename U = CcClient>
37 ,
size_t* pDispStartCount
38 ,
typename std::enable_if<!std::is_base_of<time::TimerManager, U>::value>::type* =
nullptr)
42 virtual size_t handleRangeImpl(
BufIt it,
43 BufIt end, uint16_t threadSerialNumber)
override {
44 return client_.CcClient::handleRangeImpl(it, end, threadSerialNumber);
46 virtual void messageDispatchingStartedCb(
size_t const* dispStartCount)
override {
47 client_.CcClient::messageDispatchingStartedCb(dispStartCount);
49 virtual void invokedCb(
size_t n)
override {
50 client_.CcClient::invokedCb(n);
52 virtual void stoppedCb(std::exception
const&e)
override {
53 client_.CcClient::stoppedCb(e);
55 virtual bool droppedCb()
override {
56 if (client_.CcClient::droppedCb()) {
64 CcClient& HMBDC_RESTRICT client_;
67 template <
typename... ContextProperties>
80 template <uint16_t c,
typename... ContextProperties>
82 , ContextProperties...>
92 template <
typename... ContextProperties>
94 , ContextProperties...>
103 template <
typename... ContextProperties>
105 , ContextProperties...>
113 template <
typename... ContextProperties>
115 , ContextProperties...>
123 template <
typename... ContextProperties>
125 , ContextProperties...>
136 template <
bool is_timer_manager>
139 void operator()(C&) {}
145 tm.checkTimers(SysTime::now());
149 template <
typename LFB,
typename CcClient>
150 bool runOnceImpl(uint16_t hmbdcNumber,
bool& HMBDC_RESTRICT stopped
151 , LFB& HMBDC_RESTRICT lfb, CcClient& HMBDC_RESTRICT c) {
152 typename LFB::iterator begin, end;
157 using Cc =
typename std::decay<CcClient>::type;
159 const bool clientParticipateInMessaging = Cc::INTERESTS_SIZE != 0;
160 if (clientParticipateInMessaging) {
161 uint64_t count = lfb.peek(hmbdcNumber, begin, end, c.maxBatchMessageCount());
162 c.Cc::invokedCb(c.Cc::handleRangeImpl(begin, end, hmbdcNumber));
163 lfb.wasteAfterPeek(hmbdcNumber, count);
167 }
catch (std::exception
const& e) {
186 template <
typename CcClient>
187 bool runOnceImpl(uint16_t threadSerialNumber,
bool& HMBDC_RESTRICT stopped
191 tm_runner<std::is_base_of<TimerManager, CcClient>::value> tr;
194 using Cc =
typename std::decay<CcClient>::type;
195 const bool clientParticipateInMessaging = Cc::INTERESTS_SIZE != 0;
196 if (clientParticipateInMessaging) {
197 uint64_t count = lfb.peek(begin, end, c.maxBatchMessageCount());
198 c.Cc::invokedCb(c.Cc::handleRangeImpl(begin, end, threadSerialNumber));
199 lfb.wasteAfterPeek(begin, count);
203 }
catch (std::exception
const& e) {
227 template <
typename Buffer>
228 void unblock(Buffer& lfb, uint16_t threadSerialNumber) {
229 lfb.markDead(threadSerialNumber);
Definition: MonoLockFreeBuffer.hpp:16
Definition: ContextDetail.hpp:68
Definition: ContextDetail.hpp:137
Definition: TypedString.hpp:84
Definition: Timers.hpp:70
the default vanilla allocate
Definition: Allocators.hpp:153
Unknown excpetion.
Definition: Exception.hpp:17
similar to ShmBasePtrAllocator but using dev memory
Definition: Allocators.hpp:125
Definition: BlockingBuffer.hpp:11
Definition: ContextDetail.hpp:26
Definition: LockFreeBufferT.hpp:18
Definition: PoolConsumer.hpp:16
Exception that just has an exit code.
Definition: Exception.hpp:28
helping allocating object and its aggregated objects in a continouse shared memory ...
Definition: Allocators.hpp:95
Definition: LockFreeBufferMisc.hpp:89