diff OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h @ 4594:d494b4f1103e db-changes

removed the global database mutex from ServerIndex and StatelessDatabaseOperations
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 16 Mar 2021 12:43:43 +0100
parents ff8170d17d90
children 5fabef29c4ff
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h	Mon Mar 15 18:22:53 2021 +0100
+++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.h	Tue Mar 16 12:43:43 2021 +0100
@@ -37,6 +37,8 @@
 
 #include "../../../OrthancFramework/Sources/SQLite/Connection.h"
 
+#include <boost/thread/mutex.hpp>
+
 namespace Orthanc
 {
   /**
@@ -55,10 +57,11 @@
     class ReadWriteTransaction;
     class LookupFormatter;
 
-    SQLite::Connection db_;
-    TransactionBase* activeTransaction_;
-    SignalRemainingAncestor* signalRemainingAncestor_;
-    unsigned int version_;
+    boost::mutex              mutex_;
+    SQLite::Connection        db_;
+    TransactionBase*          activeTransaction_;
+    SignalRemainingAncestor*  signalRemainingAncestor_;
+    unsigned int              version_;
 
     void GetChangesInternal(std::list<ServerIndexChange>& target,
                             bool& done,
@@ -79,19 +82,13 @@
 
     virtual void Open() ORTHANC_OVERRIDE;
 
-    virtual void Close() ORTHANC_OVERRIDE
-    {
-      db_.Close();
-    }
+    virtual void Close() ORTHANC_OVERRIDE;
 
     virtual IDatabaseWrapper::ITransaction* StartTransaction(TransactionType type,
                                                              IDatabaseListener& listener)
       ORTHANC_OVERRIDE;
 
-    virtual void FlushToDisk() ORTHANC_OVERRIDE
-    {
-      db_.FlushToDisk();
-    }
+    virtual void FlushToDisk() ORTHANC_OVERRIDE;
 
     virtual bool HasFlushToDisk() const ORTHANC_OVERRIDE
     {