hmbdc
simplify-high-performance-messaging-programming
Public Member Functions | List of all members
hmbdc::pattern::memringbuffer_detail::MemRingBuffer< parallel_consumer_count, SeqT > Class Template Reference

Public Member Functions

iterator tryClaim (size_t n) HMBDC_RESTRICT
 claim slots in the ring buffer for write, return empty iterator when not possible - this call does not block More...
 
void wasteAfterPeek (uint16_t PARALLEL_CONSUMER_INDEX, size_t size) HMBDC_RESTRICT
 for batching process, mark the next items consumed More...
 
uint64_t purge ()
 call this peroidically to mark the stuck consumers dead More...
 

Member Function Documentation

◆ purge()

template<uint16_t parallel_consumer_count, typename SeqT = size_t>
uint64_t hmbdc::pattern::memringbuffer_detail::MemRingBuffer< parallel_consumer_count, SeqT >::purge ( )
inline

call this peroidically to mark the stuck consumers dead

caller needs to make sure there r new messages between calls

Returns
mask indicating which consumer marked dead

◆ tryClaim()

template<uint16_t parallel_consumer_count, typename SeqT = size_t>
iterator hmbdc::pattern::memringbuffer_detail::MemRingBuffer< parallel_consumer_count, SeqT >::tryClaim ( size_t  n)
inline

claim slots in the ring buffer for write, return empty iterator when not possible - this call does not block

the user needs to call commit after being done with the slots

Parameters
nsize of the claimed slots
Returns
iterator pointing to the start of the slot, or empty when not possible

◆ wasteAfterPeek()

template<uint16_t parallel_consumer_count, typename SeqT = size_t>
void hmbdc::pattern::memringbuffer_detail::MemRingBuffer< parallel_consumer_count, SeqT >::wasteAfterPeek ( uint16_t  PARALLEL_CONSUMER_INDEX,
size_t  size 
)
inline

for batching process, mark the next items consumed

faster than waste, only use it if the size is what peek just returned or less. Otherwise, undefined behavior

Parameters
PARALLEL_CONSUMER_INDEXidentifying which parallel consumer
sizeconsume count

The documentation for this class was generated from the following file: