From fc77550555bbdeb4afd2f1dcf44c8f3572e2ea0a Mon Sep 17 00:00:00 2001 From: Stephen Webb Date: Wed, 16 Oct 2024 16:43:46 +1100 Subject: [PATCH] Try a stronger memory ordering constraint --- src/main/cpp/asyncappender.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cpp/asyncappender.cpp b/src/main/cpp/asyncappender.cpp index cd302f621..565a683c3 100644 --- a/src/main/cpp/asyncappender.cpp +++ b/src/main/cpp/asyncappender.cpp @@ -311,7 +311,7 @@ void AsyncAppender::append(const spi::LoggingEventPtr& event, Pool& p) priv->buffer[index] = AsyncAppenderPriv::EventData{event, pendingCount}; // Notify the dispatch thread that an event has been added auto savedEventCount = oldEventCount; - while (!priv->commitCount.compare_exchange_weak(oldEventCount, oldEventCount + 1, std::memory_order_release)) + while (!priv->commitCount.compare_exchange_weak(oldEventCount, oldEventCount + 1, std::memory_order_acq_rel)) { oldEventCount = savedEventCount; }