/home/runner/work/HiCR/HiCR/include/hicr/frontends/channel/fixedSize/mpsc/locking/consumer.hpp Source File
HiCR
|
consumer.hpp
Go to the documentation of this file.
51 * Global Memory slot pointing to the consumer's coordination buffer for acquiring a lock and updating
77 : channel::fixedSize::Base(communicationManager, internalCoordinationBuffer, tokenSize, capacity),
110 HICR_THROW_LOGIC("Attempting to peek for a token with position %lu (token number %lu when starting from zero), which is beyond than the channel capacity (%lu)",
119 if (getCommunicationManager()->acquireGlobalLock(_consumerCoordinationBuffer) == false) return bufferPos;
126 if (pos < curDepth) bufferPos = (ssize_t)((getCircularBuffer()->getTailPosition() + pos) % getCircularBuffer()->getCapacity());
152 HICR_THROW_LOGIC("Attempting to pop %lu tokens, which is larger than the channel capacity (%lu)", n, getCircularBuffer()->getCapacity());
158 if (getCommunicationManager()->acquireGlobalLock(_consumerCoordinationBuffer) == false) return successFlag;
183 [[nodiscard]] __INLINE__ std::shared_ptr<GlobalMemorySlot> getTokenBuffer() const { return _tokenBuffer; }
Definition communicationManager.hpp:54
virtual __INLINE__ void flushReceived()
Definition communicationManager.hpp:492
__INLINE__ void releaseGlobalLock(const std::shared_ptr< GlobalMemorySlot > &memorySlot)
Definition communicationManager.hpp:462
__INLINE__ CommunicationManager * getCommunicationManager() const
Definition base.hpp:217
__INLINE__ auto getCircularBuffer() const noexcept
Definition base.hpp:167
Definition base.hpp:42
Definition consumer.hpp:41
__INLINE__ ssize_t peek(const size_t pos=0)
Definition consumer.hpp:106
Consumer(CommunicationManager &communicationManager, std::shared_ptr< GlobalMemorySlot > tokenBuffer, const std::shared_ptr< LocalMemorySlot > &internalCoordinationBuffer, std::shared_ptr< GlobalMemorySlot > consumerCoordinationBuffer, const size_t tokenSize, const size_t capacity)
Definition consumer.hpp:71
__INLINE__ bool pop(const size_t n=1)
Definition consumer.hpp:149
__INLINE__ std::shared_ptr< GlobalMemorySlot > getTokenBuffer() const
Definition consumer.hpp:183
Provides a failure model and corresponding exception classes.
Provides base functionality for a fixed-size MPSC channel over HiCR.
Generated by