@@ -160,7 +160,7 @@ class LockfreeRingQueueBase {
160160// This queue may block if one of processes crashed during push / pop
161161// Do not use as IPC base. Use it to collect data and send by
162162// LockfreeSPSCRingQueue
163- template <typename T, size_t N>
163+ template <typename T, size_t N, typename MarkType = uint64_t >
164164class LockfreeMPMCRingQueue : public LockfreeRingQueueBase <T, N> {
165165protected:
166166 using Base = LockfreeRingQueueBase<T, N>;
@@ -171,20 +171,20 @@ class LockfreeMPMCRingQueue : public LockfreeRingQueueBase<T, N> {
171171
172172 struct alignas (Base::CACHELINE_SIZE ) packedslot {
173173 T data;
174- std::atomic<uint64_t > mark{0 };
174+ std::atomic<MarkType > mark{0 };
175175 };
176176
177177 packedslot slots[Base::capacity];
178178
179- uint64_t this_turn_write (const uint64_t x) const {
179+ MarkType this_turn_write (const uint64_t x) const {
180180 return (Base::turn (x) << 1 ) + 1 ;
181181 }
182182
183- uint64_t this_turn_read (const uint64_t x) const {
183+ MarkType this_turn_read (const uint64_t x) const {
184184 return (Base::turn (x) << 1 ) + 2 ;
185185 }
186186
187- uint64_t last_turn_read (const uint64_t x) const {
187+ MarkType last_turn_read (const uint64_t x) const {
188188 return Base::turn (x) << 1 ;
189189 }
190190
0 commit comments