diff --git a/Source/AuProcAddresses.Linux.cpp b/Source/AuProcAddresses.Linux.cpp index 86b98ef7..1e8e8495 100644 --- a/Source/AuProcAddresses.Linux.cpp +++ b/Source/AuProcAddresses.Linux.cpp @@ -227,15 +227,21 @@ namespace Aurora while (i < max_nr) { - auto head = pRing->head; + auto head = AuAtomicLoad(&pRing->head); if (head == pRing->tail) { break; } events[i++] = pRing->events[head]; - read_barrier(); - pRing->head = (head + 1) % pRing->nr; + + auto nextHead = (head + 1) % pRing->nr; + if (AuAtomicCompareExchange(&pRing->head, + nextHead, + head) != head) + { + i--; + } } if (!i &&