Skip to content

Commit

Permalink
Add condition variable to wait as indicated by sonarqube (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
rm5248 authored Aug 14, 2023
1 parent 5bcd74b commit 36f1d9d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/cpp/asyncappender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 36f1d9d

Please sign in to comment.