Skip to content

Commit

Permalink
fix mem ordering in work container test
Browse files Browse the repository at this point in the history
  • Loading branch information
larsgottesbueren committed Jul 13, 2023
1 parent 207ca36 commit bab2238
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/parallel/work_container_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ TEST(WorkContainer, WorkStealingWorks) {
cdc.safe_push(i, thread_id);
}

stage.fetch_add(1, std::memory_order_acq_rel);
stage.fetch_add(1, std::memory_order_acquire);

int own_element;
while (cdc.try_pop(own_element, thread_id)) {
Expand All @@ -101,7 +101,7 @@ TEST(WorkContainer, WorkStealingWorks) {

std::thread consumer([&] {
int thread_id = 1;
while (stage.load(std::memory_order_acq_rel) < 1) { } //spin
while (stage.load(std::memory_order_acquire) < 1) { } //spin

int stolen_element;
while (cdc.try_pop(stolen_element, thread_id)) {
Expand Down

0 comments on commit bab2238

Please sign in to comment.