Skip to content

Commit

Permalink
bug fix for multiple readers
Browse files Browse the repository at this point in the history
  • Loading branch information
odygrd committed Jan 27, 2024
1 parent f2b1aa6 commit 6500e84
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main()
size_t const reader_batch_size = 4;
int64_t const iterations = 10000000;

constexpr size_t MAX_READERS = 1;
constexpr size_t MAX_READERS = 3;

lockfree_queues::SPBroadcastQueue<TestObj, MAX_READERS> q{queue_size, reader_batch_size};

Expand Down
2 changes: 1 addition & 1 deletion include/lockfree_queues/sp_broadcast_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class SPBroadcastQueue
_min_read_idx_cache = _read_idx[0].load(std::memory_order_acquire);
for (size_t i = 1; i < _read_idx.size(); ++i)
{
_min_read_idx_cache = std::min(_min_read_idx_cache, _read_idx[0].load(std::memory_order_acquire));
_min_read_idx_cache = std::min(_min_read_idx_cache, _read_idx[i].load(std::memory_order_acquire));
}

if ((_min_read_idx_cache == std::numeric_limits<size_t>::max()) ||
Expand Down

0 comments on commit 6500e84

Please sign in to comment.