This is an automated email from the ASF dual-hosted git repository.
swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push:
new 3aa883c5 Improve asyncappender's handling of extremely rare contention
(#427)
3aa883c5 is described below
commit 3aa883c5da7784e21bde320a13498a05104658bc
Author: Stephen Webb <[email protected]>
AuthorDate: Fri Nov 8 12:15:08 2024 +1100
Improve asyncappender's handling of extremely rare contention (#427)
---
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 4205e557..7c7caa8d 100644
--- a/src/main/cpp/asyncappender.cpp
+++ b/src/main/cpp/asyncappender.cpp
@@ -306,7 +306,7 @@ void AsyncAppender::append(const spi::LoggingEventPtr&
event, Pool& p)
auto index = oldEventCount % priv->buffer.size();
// Wait for a free slot
while (priv->bufferSize <= oldEventCount -
priv->dispatchedCount)
- ;
+ std::this_thread::yield(); // Allow the
dispatch thread to free a slot
// Write to the ring buffer
priv->buffer[index] =
AsyncAppenderPriv::EventData{event, pendingCount};
// Notify the dispatch thread that an event has been
added