summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compat/sleep.cpp21
-rw-r--r--compat/sleep.hpp23
2 files changed, 24 insertions, 20 deletions
diff --git a/compat/sleep.cpp b/compat/sleep.cpp
new file mode 100644
index 00000000..6a22adeb
--- /dev/null
+++ b/compat/sleep.cpp
@@ -0,0 +1,21 @@
+#include "sleep.hpp"
+
+#ifdef _WIN32
+# include <windows.h>
+#else
+# include <unistd.h>
+#endif
+
+namespace portable
+{
+ OTR_COMPAT_EXPORT void sleep(int milliseconds)
+ {
+ if (milliseconds > 0)
+#ifdef _WIN32
+
+ Sleep(milliseconds);
+#else
+ usleep(unsigned(milliseconds) * 1000U); // takes microseconds
+#endif
+ }
+}
diff --git a/compat/sleep.hpp b/compat/sleep.hpp
index 4cd7a397..9419b36b 100644
--- a/compat/sleep.hpp
+++ b/compat/sleep.hpp
@@ -1,24 +1,7 @@
#pragma once
-#ifdef _WIN32
-# include <windows.h>
-#else
-# include <unistd.h>
-#endif
+#include "export.hpp"
-namespace portable
-{
-#ifdef _WIN32
- inline void sleep(int milliseconds)
- {
- if (milliseconds > 0)
- Sleep(milliseconds);
- }
-#else
- inline void sleep(int milliseconds)
- {
- if (milliseconds > 0)
- usleep(unsigned(milliseconds) * 1000U); // takes microseconds
- }
-#endif
+namespace portable {
+ OTR_COMPAT_EXPORT void sleep(int milliseconds);
}