Skip to content

Commit c0f103d

Browse files
Zainullin DamirZainullin Damir
authored andcommitted
++
1 parent d3d8c5f commit c0f103d

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

include/ipfixprobe/outputPlugin/outputStorage/ffq2OutputStorage.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class FFQ2OutputStorage : public FFQOutputStorage<ElementType> {
6969
while (!this->m_cells[readIndex].state.tryToSetReadingStarted()) {
7070
backoffScheme.backoff();
7171
}
72+
7273
// std::atomic_thread_fence(std::memory_order_acquire);
7374
this->m_readersData[readerIndex]->lastReadIndex = readIndex;
7475
/*if (this->m_storage[readIndex].empty()) {

include/ipfixprobe/outputPlugin/outputStorage/ffqOutputStorage.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ class FFQOutputStorage : public OutputStorage<ElementType> {
160160

161161
// std::atomic<uint64_t> m_startedState;
162162
// std::atomic<uint64_t> m_finishedState;
163-
std::atomic<bool> m_readingStarted {false};
164-
std::atomic<bool> m_readingFinished {false};
163+
std::atomic<bool> m_readingStarted {true};
164+
std::atomic<bool> m_readingFinished {true};
165165
std::atomic<bool> m_writingStarted {false};
166166
};
167167

@@ -174,7 +174,7 @@ class FFQOutputStorage : public OutputStorage<ElementType> {
174174
};
175175

176176
struct ReaderData {
177-
std::optional<uint16_t> lastReadIndex {0};
177+
std::optional<uint16_t> lastReadIndex {};
178178
};
179179

180180
std::array<CacheAlligned<ReaderData>, OutputStorage<ElementType>::MAX_READERS_COUNT>

include/ipfixprobe/outputPlugin/outputStorage/outputStorage.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ class OutputStorage {
7070
m_writersCount--;
7171
}
7272

73-
bool writersPresent() const noexcept { return m_writersCount > 0; }
73+
bool writersPresent() const noexcept
74+
{
75+
return m_writersCount.load(std::memory_order_acquire) > 0;
76+
}
7477

7578
virtual bool finished() noexcept = 0;
7679

0 commit comments

Comments
 (0)