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 detail {
25 template <
typename... ContextProperties>
31 can_start_anytime = 0,
37 template <uint16_t c,
typename... ContextProperties>
39 , ContextProperties...>
48 template <
typename... ContextProperties>
50 , ContextProperties...>
60 template <
typename... ContextProperties>
62 , ContextProperties...>
71 template <
typename... ContextProperties>
73 , ContextProperties...>
85 template <
bool is_timer_manager>
88 void operator()(C&) {}
94 tm.checkTimers(SysTime::now());
98 template <
typename LFB,
typename Client>
99 bool runOnceImpl(uint16_t threadSerialNumber,
bool& __restrict__ stopped, LFB& __restrict__ lfb,
Client& __restrict__ c) {
100 typename LFB::iterator begin, end;
105 const bool clientParticipateInMessaging =
106 std::remove_reference<Client>::type::REGISTERED_MESSAGE_SIZE;
107 if (clientParticipateInMessaging) {
108 uint64_t count = lfb.peek(threadSerialNumber, begin, end, c.maxBatchMessageCount());
109 c.Client::handleRangeImpl(begin, end, threadSerialNumber);
110 c.Client::invokedCb(threadSerialNumber);
111 lfb.wasteAfterPeek(threadSerialNumber, count);
113 c.Client::invokedCb(0xffffu - threadSerialNumber);
115 }
catch (std::exception
const& e) {
134 template <
typename Client>
141 const bool clientParticipateInMessaging =
142 std::remove_reference<Client>::type::REGISTERED_MESSAGE_SIZE;
143 if (clientParticipateInMessaging) {
144 uint64_t count = lfb.peek(begin, end, c.maxBatchMessageCount());
146 c.Client::handleRangeImpl(b, end, threadSerialNumber);
147 c.Client::invokedCb(threadSerialNumber);
148 lfb.wasteAfterPeek(begin, count);
150 c.Client::invokedCb(0xffffu - threadSerialNumber);
152 }
catch (std::exception
const& e) {
175 template <
typename Buffer>
176 void unblock(Buffer& lfb, uint16_t threadSerialNumber) {
177 lfb.markDead(threadSerialNumber);
Definition: MonoLockFreeBuffer.hpp:14
Definition: ContextDetail.hpp:86
Definition: TypedString.hpp:74
Definition: Timers.hpp:69
the default vanilla allocate
Definition: Allocators.hpp:114
Definition: Exception.hpp:14
Definition: LockFreeBufferT.hpp:18
Definition: ContextDetail.hpp:26
Definition: Client.hpp:39
Definition: Exception.hpp:22
helping allocating object and its aggregated objects in a continouse shared memory ...
Definition: Allocators.hpp:86
Definition: Client.hpp:11
Definition: LockFreeBufferMisc.hpp:73