Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
common: use correct atomics in ringbuf
Browse files Browse the repository at this point in the history
  • Loading branch information
pbalcer committed Jul 11, 2022
1 parent f1203f5 commit 2490b0c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/ringbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,9 @@ ringbuf_dequeue_atomic(struct ringbuf *rbuf)

VALGRIND_ANNOTATE_HAPPENS_AFTER(&rbuf->data[r]);
do {
while ((data = rbuf->data[r]) == NULL)
__sync_synchronize();
do {
util_atomic_load64(&rbuf->data[r], &data);
} while (data == NULL);
} while (!util_bool_compare_and_swap64(&rbuf->data[r], data, NULL));

return data;
Expand Down

0 comments on commit 2490b0c

Please sign in to comment.