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 {
23 template <
typename CcClient>
26 template <
typename U = CcClient>
28 ,
size_t* pDispStartCount
29 ,
typename std::enable_if<std::is_base_of<time::TimerManager, U>::value>::type* =
nullptr)
33 template <
typename U = CcClient>
35 ,
size_t* pDispStartCount
36 ,
typename std::enable_if<!std::is_base_of<time::TimerManager, U>::value>::type* =
nullptr)
40 virtual size_t handleRangeImpl(
BufIt it,
41 BufIt end, uint16_t threadSerialNumber)
override {
42 return client_.CcClient::handleRangeImpl(it, end, threadSerialNumber);
44 virtual void messageDispatchingStartedCb(
size_t const* dispStartCount)
override {
45 client_.CcClient::messageDispatchingStartedCb(dispStartCount);
47 virtual void invokedCb(
size_t n)
override {
48 client_.CcClient::invokedCb(n);
50 virtual void stoppedCb(std::exception
const&e)
override {
51 client_.CcClient::stoppedCb(e);
53 virtual bool droppedCb()
override {
54 if (client_.CcClient::droppedCb()) {
62 CcClient& HMBDC_RESTRICT client_;
65 template <
typename... ContextProperties>
78 template <uint16_t c,
typename... ContextProperties>
80 , ContextProperties...>
90 template <
typename... ContextProperties>
92 , ContextProperties...>
101 template <
typename... ContextProperties>
103 , ContextProperties...>
111 template <
typename... ContextProperties>
113 , ContextProperties...>
121 template <
typename... ContextProperties>
123 , ContextProperties...>
131 template <
bool is_timer_manager>
134 void operator()(C&) {}
140 tm.checkTimers(hmbdc::time::SysTime::now());
144 template <
typename LFB,
typename CcClient>
145 bool runOnceImpl(uint16_t hmbdcNumber,
bool& HMBDC_RESTRICT stopped
146 , LFB& HMBDC_RESTRICT lfb, CcClient& HMBDC_RESTRICT c) {
147 typename LFB::iterator begin, end;
152 using Cc =
typename std::decay<CcClient>::type;
154 const bool clientParticipateInMessaging = Cc::INTERESTS_SIZE != 0;
155 if (clientParticipateInMessaging) {
156 uint64_t count = lfb.peek(hmbdcNumber, begin, end, c.maxBatchMessageCount());
157 c.Cc::invokedCb(c.Cc::handleRangeImpl(begin, end, hmbdcNumber));
158 lfb.wasteAfterPeek(hmbdcNumber, count);
162 }
catch (std::exception
const& e) {
181 template <
typename CcClient>
182 bool runOnceImpl(uint16_t threadSerialNumber,
bool& HMBDC_RESTRICT stopped
186 tm_runner<std::is_base_of<hmbdc::time::TimerManager, CcClient>::value> tr;
189 using Cc =
typename std::decay<CcClient>::type;
190 const bool clientParticipateInMessaging = Cc::INTERESTS_SIZE != 0;
191 if (clientParticipateInMessaging) {
192 uint64_t count = lfb.peek(begin, end, c.maxBatchMessageCount());
193 c.Cc::invokedCb(c.Cc::handleRangeImpl(begin, end, threadSerialNumber));
194 lfb.wasteAfterPeek(begin, count);
198 }
catch (std::exception
const& e) {
222 template <
typename Buffer>
223 void unblock(Buffer& lfb, uint16_t threadSerialNumber) {
224 lfb.markDead(threadSerialNumber);
Definition: MonoLockFreeBuffer.hpp:16
Definition: ContextDetail.hpp:66
Definition: ContextDetail.hpp:132
Definition: Timers.hpp:70
the default vanilla allocate
Definition: Allocators.hpp:157
Unknown excpetion.
Definition: Exception.hpp:17
similar to ShmBasePtrAllocator but using dev memory
Definition: Allocators.hpp:130
Definition: ContextDetail.hpp:24
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