This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch improve_async_appender
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit 10c4ffb087e2f82724b585bef0a3c233465c33ca
Merge: 18bad3a2 5ec8ac2a
Author: Stephen Webb <[email protected]>
AuthorDate: Fri Mar 8 13:05:57 2024 +1100

    Merge branch 'master' into improve_async_appender

 src/main/cpp/appenderskeleton.cpp                  |   4 +-
 src/main/cpp/asyncappender.cpp                     |  10 +-
 src/main/include/log4cxx/asyncappender.h           |  40 +++++--
 .../include/log4cxx/spi/location/locationinfo.h    |   1 +
 src/test/cpp/benchmark/benchmark.cpp               | 133 ++++++++++++++-------
 5 files changed, 127 insertions(+), 61 deletions(-)

diff --cc src/main/cpp/asyncappender.cpp
index 4681b7b8,5c540cff..50eaf789
--- a/src/main/cpp/asyncappender.cpp
+++ b/src/main/cpp/asyncappender.cpp
@@@ -300,11 -233,11 +300,14 @@@ void AsyncAppender::append(const spi::L
        // Get a copy of this thread's MDC.
        event->getMDCCopy();
  
 -      std::unique_lock<std::mutex> lock(priv->bufferMutex);
        if (!priv->dispatcher.joinable())
        {
 -              priv->dispatcher = ThreadUtility::instance()->createThread( 
LOG4CXX_STR("AsyncAppender"), &AsyncAppender::dispatch, this );
 +              std::unique_lock<std::mutex> lock(priv->bufferMutex);
 +              if (!priv->dispatcher.joinable())
 +                      priv->dispatcher = 
ThreadUtility::instance()->createThread( LOG4CXX_STR("AsyncAppender"), 
&AsyncAppender::dispatch, this );
++#if !USE_ATOMIC_QUEUE
+               priv->buffer.reserve(priv->bufferSize);
++#endif
        }
        while (true)
        {

Reply via email to