You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rm...@apache.org on 2023/08/13 00:50:53 UTC
[logging-log4cxx] 01/01: Add condition variable to wait as indicated by sonarqube
This is an automated email from the ASF dual-hosted git repository.
rmiddleton pushed a commit to branch add-condition-argument
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
commit 6cf6d04a7bda295c01048ffe4ff367c982c6f420
Author: Robert Middleton <ro...@rm5248.com>
AuthorDate: Sat Aug 12 20:50:38 2023 -0400
Add condition variable to wait as indicated by sonarqube
---
src/main/cpp/asyncappender.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/main/cpp/asyncappender.cpp b/src/main/cpp/asyncappender.cpp
index 20ff3cd8..d31682c3 100644
--- a/src/main/cpp/asyncappender.cpp
+++ b/src/main/cpp/asyncappender.cpp
@@ -253,7 +253,10 @@ void AsyncAppender::append(const spi::LoggingEventPtr& event, Pool& p)
&& !priv->closed
&& (priv->dispatcher.get_id() != std::this_thread::get_id()) )
{
- priv->bufferNotFull.wait(lock);
+ priv->bufferNotFull.wait(lock, [this]()
+ {
+ return priv->buffer.empty();
+ });
discard = false;
}