Skip to content

Commit

Permalink
Merge pull request #2357 from tang-qh/iox-2351-fix-loffli-aba-counter…
Browse files Browse the repository at this point in the history
…-not-unique

iox-#2351 fix mpmc_loffli abaCounter not unique
  • Loading branch information
elfenpiff authored Oct 8, 2024
2 parents 00c5349 + 12ee36c commit 89d73e0
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 89d73e0

Please sign in to comment.