diff OrthancServer/OrthancRestApi.cpp @ 526:e318e9d49815 dicom-rt

rt-struct
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Aug 2013 17:33:33 +0200
parents 1b2cdc855bd3
children b82292ba2083
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi.cpp	Thu Aug 29 15:10:05 2013 +0200
+++ b/OrthancServer/OrthancRestApi.cpp	Thu Aug 29 17:33:33 2013 +0200
@@ -64,11 +64,6 @@
 
 namespace Orthanc
 {
-  // TODO IMPROVE MULTITHREADING
-  // Every call to "ParsedDicomFile" must lock this mutex!!!
-  static boost::mutex cacheMutex_;
-
-
   // DICOM SCU ----------------------------------------------------------------
 
   static void ConnectToModality(DicomUserConnection& connection,
@@ -977,9 +972,9 @@
 
   static void GetRawContent(RestApi::GetCall& call)
   {
-    boost::mutex::scoped_lock lock(cacheMutex_);
+    RETRIEVE_CONTEXT(call);
+    boost::mutex::scoped_lock lock(context.GetDicomFileMutex());
 
-    RETRIEVE_CONTEXT(call);
     std::string id = call.GetUriComponent("id", "");
     ParsedDicomFile& dicom = context.GetDicomFile(id);
     dicom.SendPathValue(call.GetOutput(), call.GetTrailingUri());
@@ -1260,8 +1255,8 @@
                                         bool removePrivateTags,
                                         RestApi::PostCall& call)
   {
-    boost::mutex::scoped_lock lock(cacheMutex_);
     RETRIEVE_CONTEXT(call);
+    boost::mutex::scoped_lock lock(context.GetDicomFileMutex());
     
     std::string id = call.GetUriComponent("id", "");
     ParsedDicomFile& dicom = context.GetDicomFile(id);
@@ -1338,8 +1333,8 @@
     bool isFirst = true;
     Json::Value result(Json::objectValue);
 
-    boost::mutex::scoped_lock lock(cacheMutex_);
     RETRIEVE_CONTEXT(call);
+    boost::mutex::scoped_lock lock(context.GetDicomFileMutex());
 
     Instances instances;
     std::string id = call.GetUriComponent("id", "");