# HG changeset patch # User Sebastien Jodogne # Date 1776097775 -7200 # Node ID 688f0f78ddfcf86eea5f73731d199e7baef5a9af # Parent 2c1b578ed9bad17c8e0de2163d8ea3f449eeec08 further build optimization diff -r 2c1b578ed9ba -r 688f0f78ddfc OrthancFramework/Sources/Logging.cpp --- a/OrthancFramework/Sources/Logging.cpp Mon Apr 13 17:52:49 2026 +0200 +++ b/OrthancFramework/Sources/Logging.cpp Mon Apr 13 18:29:35 2026 +0200 @@ -912,12 +912,22 @@ } + struct InternalLogger::PImpl + { + boost::mutex::scoped_lock lock_; + + PImpl() : lock_(loggingStreamsMutex_, boost::defer_lock_t()) + { + } + }; + + InternalLogger::InternalLogger(LogLevel level, LogCategory category, const char* pluginName, const char* file, int line) : - lock_(loggingStreamsMutex_, boost::defer_lock_t()), + pimpl_(new PImpl), level_(level), stream_(&nullStream_), // By default, logging to "/dev/null" is simulated category_(category), @@ -953,14 +963,14 @@ { // We lock the global mutex. The mutex is locked until the // destructor is called: No change in the output can be done. - lock_.lock(); + pimpl_->lock_.lock(); if (loggingStreamsContext_.get() == NULL) { // Have you called Orthanc::Logging::InitializePluginContext()? fprintf(stderr, "ERROR: Trying to log a message after the finalization of the logging engine " "(or did you forgot to initialize it?)\n"); - lock_.unlock(); + pimpl_->lock_.unlock(); return; } @@ -988,7 +998,7 @@ { // The logging is disabled for this level, we can release // the global mutex. - lock_.unlock(); + pimpl_->lock_.unlock(); } else { @@ -1064,8 +1074,10 @@ { (*it)->HandleLog(level_, category_, pluginName_, file_, line_, messageStream_.str()); } + } - } + assert(pimpl_ != NULL); + delete pimpl_; } diff -r 2c1b578ed9ba -r 688f0f78ddfc OrthancFramework/Sources/Logging.h --- a/OrthancFramework/Sources/Logging.h Mon Apr 13 17:52:49 2026 +0200 +++ b/OrthancFramework/Sources/Logging.h Mon Apr 13 18:29:35 2026 +0200 @@ -267,7 +267,6 @@ ORTHANC_ENABLE_LOGGING_STDIO == 0) #include -#include #include namespace Orthanc @@ -277,7 +276,9 @@ class ORTHANC_PUBLIC InternalLogger : public boost::noncopyable { private: - boost::mutex::scoped_lock lock_; + struct PImpl; + PImpl* pimpl_; // This encapsulates a "boost::mutex::scoped_lock", which is a heavyweight structure + LogLevel level_; std::ostream* stream_; LogCategory category_; diff -r 2c1b578ed9ba -r 688f0f78ddfc OrthancFramework/Sources/SQLite/Statement.cpp --- a/OrthancFramework/Sources/SQLite/Statement.cpp Mon Apr 13 17:52:49 2026 +0200 +++ b/OrthancFramework/Sources/SQLite/Statement.cpp Mon Apr 13 18:29:35 2026 +0200 @@ -45,6 +45,7 @@ #include "Statement.h" #include "Connection.h" +#include #include #include #include