changeset 1306:8cd5784a6d80

IDatabaseWrapper::HasFlushToDisk()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 10 Feb 2015 17:17:25 +0100
parents 536515f87cb4
children f796207e3df1
files OrthancServer/DatabaseWrapper.h OrthancServer/IDatabaseWrapper.h OrthancServer/ServerIndex.cpp
diffstat 3 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapper.h	Tue Feb 10 17:11:00 2015 +0100
+++ b/OrthancServer/DatabaseWrapper.h	Tue Feb 10 17:17:25 2015 +0100
@@ -190,6 +190,11 @@
       db_.FlushToDisk();
     }
 
+    virtual bool HasFlushToDisk() const
+    {
+      return true;
+    }
+
     virtual void ClearChanges()
     {
       ClearTable("Changes");
--- a/OrthancServer/IDatabaseWrapper.h	Tue Feb 10 17:11:00 2015 +0100
+++ b/OrthancServer/IDatabaseWrapper.h	Tue Feb 10 17:17:25 2015 +0100
@@ -73,6 +73,8 @@
 
     virtual void FlushToDisk() = 0;
 
+    virtual bool HasFlushToDisk() const = 0;
+
     virtual void GetAllMetadata(std::map<MetadataType, std::string>& target,
                                 int64_t id) = 0;
 
--- a/OrthancServer/ServerIndex.cpp	Tue Feb 10 17:11:00 2015 +0100
+++ b/OrthancServer/ServerIndex.cpp	Tue Feb 10 17:17:25 2015 +0100
@@ -553,7 +553,11 @@
     // execution of Orthanc
     StandaloneRecycling();
 
-    flushThread_ = boost::thread(FlushThread, this);
+    if (db.HasFlushToDisk())
+    {
+      flushThread_ = boost::thread(FlushThread, this);
+    }
+
     unstableResourcesMonitorThread_ = boost::thread(UnstableResourcesMonitorThread, this);
   }
 
@@ -562,7 +566,8 @@
   {
     done_ = true;
 
-    if (flushThread_.joinable())
+    if (db_.HasFlushToDisk() &&
+        flushThread_.joinable())
     {
       flushThread_.join();
     }