Skip to content

Commit

Permalink
Fix data race in ordered_queue tests
Browse files Browse the repository at this point in the history
Was caused accessing the global variable *num_items* in the constructor
of an Item sent to the queue. This is not permissible since items are accessed
in parallel by separate threads.
  • Loading branch information
daljit46 committed Apr 26, 2024
1 parent 9767828 commit 5e6ff81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion testing/unit_tests/ordered_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
using namespace MR;
using namespace App;

size_t num_items;
std::atomic<size_t> num_items;

#define START(msg) \
{ \
Expand Down

0 comments on commit 5e6ff81

Please sign in to comment.