diff Platforms/Generic/Oracle.cpp @ 271:46c5296d867e am-2

OracleWebService and BasicSdlApplicationContext using the same global mutex
author am@osimis.io
date Thu, 23 Aug 2018 17:12:54 +0200
parents 5412adf19980
children 14ef1227120f
line wrap: on
line diff
--- a/Platforms/Generic/Oracle.cpp	Thu Aug 23 14:45:04 2018 +0200
+++ b/Platforms/Generic/Oracle.cpp	Thu Aug 23 17:12:54 2018 +0200
@@ -27,6 +27,7 @@
 
 #include <vector>
 #include <stdio.h>
+#include <boost/thread/mutex.hpp>
 
 namespace OrthancStone
 {
@@ -40,7 +41,6 @@
       State_Stopped
     };
 
-    boost::mutex*                  globalMutex_;
     boost::mutex                   oracleMutex_;
     State                          state_;
     std::vector<boost::thread*>    threads_;
@@ -71,23 +71,13 @@
           // Random sleeping to test
           //boost::this_thread::sleep(boost::posix_time::milliseconds(50 * (1 + rand() % 10)));
 
-          if (that->globalMutex_ != NULL)
-          {
-            boost::mutex::scoped_lock lock(*that->globalMutex_);
-            command.Commit();
-          }
-          else
-          {
-            command.Commit();
-          }
+          command.Commit();
         }
       }
     }
     
   public:
-    PImpl(boost::mutex* globalMutex,
-          unsigned int threadCount) :
-      globalMutex_(globalMutex),
+    PImpl(unsigned int threadCount) :
       state_(State_Init),
       threads_(threadCount)
     {
@@ -182,19 +172,11 @@
   };
   
 
-  Oracle::Oracle(boost::mutex& globalMutex,
-                 unsigned int threadCount) :
-    pimpl_(new PImpl(&globalMutex, threadCount))
+  Oracle::Oracle(unsigned int threadCount) :
+    pimpl_(new PImpl(threadCount))
   {
   }
 
-
-  Oracle::Oracle(unsigned int threadCount) :
-    pimpl_(new PImpl(NULL, threadCount))
-  {
-  }
-
-
   void Oracle::Start()
   {
     pimpl_->Start();