From 72b09cb0852c3801e1b68b113dd33ab7658c4935 Mon Sep 17 00:00:00 2001 From: J Reece Wilson Date: Mon, 5 Aug 2024 05:19:58 +0100 Subject: [PATCH] [*] Fix: axboe is a piss baby retard who cant even write a thread safe ring buffer This is the dude tasked with managing Linshits IO stack, including the fundamentally flawed muh zero-syscall pissring, the fucked io_submit apis that never worked properly (incl io_cancel that spuriously returns EINVAL despite all magics matching), the retard who stuck to Linus's idea that MUH O_DIRECT IS LE EVIL YOU MUST USE MY CACHES REEE REEE, and the retard who got indirectly called out by Linus as being apart of the database maintainers who Linus didn't/doesnt like and who wanted these APIs in the first place. --- Source/AuProcAddresses.Linux.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 &&