Mercurial > hg > orthanc
changeset 6262:dbfcecfb5f60
increased parallelism by making auditLogHandlersMutex_ a read-writer lock
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Mon, 11 Aug 2025 08:25:31 +0200 |
| parents | 016c25ae2915 |
| children | fb8bed996341 |
| files | NEWS OrthancServer/Plugins/Engine/OrthancPlugins.cpp |
| diffstat | 2 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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.
--- 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<const _OrthancPluginAuditLogHandler*>(parameters); + boost::unique_lock<boost::shared_mutex> 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<boost::shared_mutex> 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,
