Skip to content

Commit

Permalink
iox-#2351 fix mpmc_loffli abaCounter not unique
Browse files Browse the repository at this point in the history
  • Loading branch information
tangqihong committed Oct 8, 2024
1 parent 00c5349 commit 12ee36c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions iceoryx_hoofs/concurrent/buffer/source/mpmc_loffli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool MpmcLoFFLi::pop(Index_t& index) noexcept

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

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

return true;
Expand Down

0 comments on commit 12ee36c

Please sign in to comment.