diff OrthancFramework/Sources/DicomParsing/DicomModification.cpp @ 5141:023569e7155b

moved DicomModification thread safety into ResourceModificationJob (trying to avoid mutex in OrthancFramework as much as possible)
author Alain Mazy <am@osimis.io>
date Fri, 20 Jan 2023 18:10:42 +0100
parents 15109c3f0f7d
children 02cfd23a556a
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Fri Jan 20 17:24:35 2023 +0100
+++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Fri Jan 20 18:10:42 2023 +0100
@@ -439,8 +439,6 @@
                                                         const std::string& mapped,
                                                         ResourceType level)
   {
-    boost::recursive_mutex::scoped_lock lock(uidMapMutex_);
-
     UidMap::const_iterator previous = uidMap_.find(std::make_pair(level, original));
 
     if (previous == uidMap_.end())
@@ -452,8 +450,6 @@
   std::string DicomModification::MapDicomIdentifier(const std::string& original,
                                                     ResourceType level)
   {
-    boost::recursive_mutex::scoped_lock lock(uidMapMutex_);
-
     const std::string stripped = Toolbox::StripSpaces(original);
     
     std::string mapped;
@@ -694,8 +690,6 @@
 
   void DicomModification::SetLevel(ResourceType level)
   {
-    boost::recursive_mutex::scoped_lock lock(uidMapMutex_);
-
     uidMap_.clear();
     level_ = level;
 
@@ -851,8 +845,6 @@
 
   void DicomModification::SetupAnonymization(DicomVersion version)
   {
-    boost::recursive_mutex::scoped_lock lock(uidMapMutex_);
-
     isAnonymization_ = true;
     
     keep_.clear();
@@ -1429,8 +1421,6 @@
   
   void DicomModification::Serialize(Json::Value& value) const
   {
-    boost::recursive_mutex::scoped_lock lock(uidMapMutex_);
-
     if (identifierGenerator_ != NULL)
     {
       throw OrthancException(ErrorCode_InternalError,
@@ -1556,8 +1546,6 @@
                                             const Json::Value& serialized,
                                             const char* field)
   {
-    boost::recursive_mutex::scoped_lock lock(uidMapMutex_);
-
     if (!serialized.isMember(field) ||
         serialized[field].type() != Json::objectValue)
     {