# HG changeset patch # User Sebastien Jodogne # Date 1754893531 -7200 # Node ID dbfcecfb5f6075a19b3fda781d8c4b6cddbdf89d # Parent 016c25ae291542d484423279144e5942c7b212f2 increased parallelism by making auditLogHandlersMutex_ a read-writer lock diff -r 016c25ae2915 -r dbfcecfb5f60 NEWS --- a/NEWS Sun Aug 10 15:40:12 2025 +0200 +++ b/NEWS Mon Aug 11 08:25:31 2025 +0200 @@ -32,7 +32,7 @@ DICOM resource from a plugin. - "OrthancPluginRegisterHttpAuthentication()" to install a custom callback to authenticate HTTP requests. - - "OrthancPluginAuditLog()" to generate an audit log. + - "OrthancPluginEmitAuditLog()" to generate an audit log. - "OrthancPluginRegisterAuditLogHandler()" to handle audit logs. * The OrthancPluginHttpRequest structure provides the payload of the possible HTTP authentication callback. diff -r 016c25ae2915 -r dbfcecfb5f60 OrthancServer/Plugins/Engine/OrthancPlugins.cpp --- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp Sun Aug 10 15:40:12 2025 +0200 +++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp Mon Aug 11 08:25:31 2025 +0200 @@ -1755,7 +1755,7 @@ boost::mutex storageCommitmentScpMutex_; boost::recursive_mutex invokeServiceMutex_; boost::shared_mutex incomingHttpRequestFilterMutex_; // New in Orthanc 1.8.2 - boost::recursive_mutex auditLogHandlersMutex_; // New in Orthanc 1.12.9 + boost::shared_mutex auditLogHandlersMutex_; // New in Orthanc 1.12.9 Properties properties_; int argc_; @@ -3134,11 +3134,11 @@ void OrthancPlugins::RegisterAuditLogHandler(const void* parameters) { - boost::recursive_mutex::scoped_lock lock(pimpl_->auditLogHandlersMutex_); - const _OrthancPluginAuditLogHandler& p = *reinterpret_cast(parameters); + boost::unique_lock lock(pimpl_->auditLogHandlersMutex_); + CLOG(INFO, PLUGINS) << "Plugin has registered an AuditLog handler"; pimpl_->auditLogHandlers_.push_back(p.handler); } @@ -4785,9 +4785,10 @@ void OrthancPlugins::ApplyEmitAuditLog(const _OrthancPluginEmitAuditLog& parameters) { - PImpl::ServerContextReference lock(*pimpl_); - - for (PImpl::AuditLogHandlers::const_iterator handler = pimpl_->auditLogHandlers_.begin(); handler != pimpl_->auditLogHandlers_.end(); ++handler) + boost::unique_lock lock(pimpl_->auditLogHandlersMutex_); + + for (PImpl::AuditLogHandlers::const_iterator handler = pimpl_->auditLogHandlers_.begin(); + handler != pimpl_->auditLogHandlers_.end(); ++handler) { OrthancPluginErrorCode error = (*handler) ( parameters.userId, parameters.sourcePlugin, parameters.resourceType,