diff Orthanc/Core/SystemToolbox.cpp @ 159:5dc54316d68b

shared copyright with osimis
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 04 Jan 2017 16:41:43 +0100
parents 08f30c8962a7
children bd5597966b3d
line wrap: on
line diff
--- a/Orthanc/Core/SystemToolbox.cpp	Wed Dec 14 16:49:00 2016 +0100
+++ b/Orthanc/Core/SystemToolbox.cpp	Wed Jan 04 16:41:43 2017 +0100
@@ -2,6 +2,7 @@
  * Orthanc - A Lightweight, RESTful DICOM Store
  * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017 Osimis, Belgium
  *
  * This program is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -123,7 +124,7 @@
     barrierEvent_ = ServerBarrierEvent_Stop;
     while (!(*stopFlag || finish_))
     {
-      Toolbox::USleep(100 * 1000);
+      SystemToolbox::USleep(100 * 1000);
     }
 
 #if defined(_WIN32)
@@ -152,6 +153,18 @@
   }
 
 
+  void SystemToolbox::USleep(uint64_t microSeconds)
+  {
+#if defined(_WIN32)
+    ::Sleep(static_cast<DWORD>(microSeconds / static_cast<uint64_t>(1000)));
+#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__native_client__)
+    usleep(microSeconds);
+#else
+#error Support your platform here
+#endif
+  }
+
+
   static std::streamsize GetStreamSize(std::istream& f)
   {
     // http://www.cplusplus.com/reference/iostream/istream/tellg/