1 #include "hmbdc/Copyright.hpp" 5 #include "hmbdc/app/Client.hpp" 6 #include "hmbdc/app/Message.hpp" 7 #include "hmbdc/comm/Topic.hpp" 9 #include "hmbdc/pattern/PoolT.hpp" 10 #include "hmbdc/pattern/LockFreeBufferT.hpp" 11 #include "hmbdc/pattern/MonoLockFreeBuffer.hpp" 13 #include "hmbdc/os/Thread.hpp" 14 #include "hmbdc/time/Timers.hpp" 15 #include "hmbdc/numeric/BitMath.hpp" 19 #include <type_traits> 24 namespace hmbdc {
namespace app {
namespace context_detail {
28 template <
typename... ContextProperties>
34 can_start_anytime = 0,
40 template <uint16_t c,
typename... ContextProperties>
42 , ContextProperties...>
51 template <
typename... ContextProperties>
53 , ContextProperties...>
63 template <
typename... ContextProperties>
65 , ContextProperties...>
74 template <
typename... ContextProperties>
76 , ContextProperties...>
88 template <
bool is_timer_manager>
91 void operator()(C&) {}
97 tm.checkTimers(SysTime::now());
101 template <
typename LFB,
typename CcClient>
102 bool runOnceImpl(uint16_t threadSerialNumber,
bool& HMBDC_RESTRICT stopped, LFB& HMBDC_RESTRICT lfb, CcClient& HMBDC_RESTRICT c) {
103 typename LFB::iterator begin, end;
108 const bool clientParticipateInMessaging =
109 std::remove_reference<CcClient>::type::REGISTERED_MESSAGE_SIZE;
110 if (clientParticipateInMessaging) {
111 uint64_t count = lfb.peek(threadSerialNumber, begin, end, c.maxBatchMessageCount());
112 c.CcClient::handleRangeImpl(begin, end, threadSerialNumber);
113 c.CcClient::invokedCb(threadSerialNumber);
114 lfb.wasteAfterPeek(threadSerialNumber, count);
116 c.CcClient::invokedCb(0xffffu - threadSerialNumber);
118 }
catch (std::exception
const& e) {
137 template <
typename CcClient>
144 const bool clientParticipateInMessaging =
145 std::remove_reference<CcClient>::type::REGISTERED_MESSAGE_SIZE;
146 if (clientParticipateInMessaging) {
147 uint64_t count = lfb.peek(begin, end, c.maxBatchMessageCount());
149 c.CcClient::handleRangeImpl(b, end, threadSerialNumber);
150 c.CcClient::invokedCb(threadSerialNumber);
151 lfb.wasteAfterPeek(begin, count);
153 c.CcClient::invokedCb(0xffffu - threadSerialNumber);
155 }
catch (std::exception
const& e) {
178 template <
typename Buffer>
179 void unblock(Buffer& lfb, uint16_t threadSerialNumber) {
180 lfb.markDead(threadSerialNumber);
Definition: MonoLockFreeBuffer.hpp:14
Definition: ContextDetail.hpp:29
Definition: ContextDetail.hpp:89
Definition: TypedString.hpp:74
Definition: Timers.hpp:65
the default vanilla allocate
Definition: Allocators.hpp:116
Unknown excpetion.
Definition: Exception.hpp:17
Definition: GuardedSingleton.hpp:9
Definition: LockFreeBufferT.hpp:18
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:88
Definition: LockFreeBufferMisc.hpp:73