Skip to content

Commit 89d73e0

Browse files
authored
Merge pull request #2357 from tang-qh/iox-2351-fix-loffli-aba-counter-not-unique
iox-#2351 fix mpmc_loffli abaCounter not unique
2 parents 00c5349 + 12ee36c commit 89d73e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

iceoryx_hoofs/concurrent/buffer/source/mpmc_loffli.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ bool MpmcLoFFLi::pop(Index_t& index) noexcept
5959

6060
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) upper limit of index set by m_size
6161
newHead.indexToNextFreeIndex = m_nextFreeIndex.get()[oldHead.indexToNextFreeIndex];
62-
newHead.abaCounter += 1;
62+
newHead.abaCounter = oldHead.abaCounter + 1;
6363
} while (!m_head.compare_exchange_weak(oldHead, newHead, std::memory_order_acq_rel, std::memory_order_acquire));
6464

6565
/// comes from outside, is not shared and therefore no synchronization is needed
@@ -105,7 +105,7 @@ bool MpmcLoFFLi::push(const Index_t index) noexcept
105105
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) index is limited by capacity
106106
m_nextFreeIndex.get()[index] = oldHead.indexToNextFreeIndex;
107107
newHead.indexToNextFreeIndex = index;
108-
newHead.abaCounter += 1;
108+
newHead.abaCounter = oldHead.abaCounter + 1;
109109
} while (!m_head.compare_exchange_weak(oldHead, newHead, std::memory_order_acq_rel, std::memory_order_acquire));
110110

111111
return true;

0 commit comments

Comments
 (0)