Skip to content

Commit 7898371

Browse files
Zainullin DamirZainullin Damir
authored andcommitted
++
1 parent 00cc331 commit 7898371

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

include/ipfixprobe/outputPlugin/outputStorage/allocationBufferS.hpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,21 @@ class AllocationBufferS : public AllocationBufferBase<ElementType> {
133133

134134
void clearStealRequest(const uint8_t victimIndex) noexcept
135135
{
136-
HelpState currentValue = m_helpStates[victimIndex]->load(std::memory_order_acquire);
137-
currentValue.stealingRequested = false;
138-
m_helpStates[victimIndex]->store(currentValue, std::memory_order_release);
136+
HelpState expected;
137+
HelpState desired;
138+
do {
139+
expected = m_helpStates[victimIndex]->load(std::memory_order_acquire);
140+
desired = expected;
141+
desired.stealingRequested = false;
142+
} while (!m_helpStates[victimIndex]->compare_exchange_weak(
143+
expected,
144+
desired,
145+
std::memory_order_release,
146+
std::memory_order_acquire));
139147
}
148+
/*= m_helpStates[victimIndex]->load(std::memory_order_acquire);
149+
currentValue.stealingRequested = false;
150+
m_helpStates[victimIndex]->store(currentValue, std::memory_order_release);*/
140151

141152
struct WriterData {
142153
explicit WriterData(ElementType* begin, const std::size_t size) noexcept

0 commit comments

Comments
 (0)