]> Git Repo - VerusCoin.git/commitdiff
Move SetThreadPriority implementation to util.cpp instead of the header
authorWladimir J. van der Laan <[email protected]>
Wed, 20 Aug 2014 15:43:56 +0000 (17:43 +0200)
committerWladimir J. van der Laan <[email protected]>
Tue, 26 Aug 2014 11:25:21 +0000 (13:25 +0200)
Put the THREAD_* and PRIO_ constants in compat.h.

src/compat.h
src/util.cpp
src/util.h

index 52c7817130fbfe5b2b468109a08706b3b50ed794..3f0a8b6158c1e08775e40407754921984810bf1c 100644 (file)
@@ -59,4 +59,15 @@ typedef u_int SOCKET;
 #define SOCKET_ERROR        -1
 #endif
 
+#ifndef WIN32
+// PRIO_MAX is not defined on Solaris
+#ifndef PRIO_MAX
+#define PRIO_MAX 20
+#endif
+#define THREAD_PRIORITY_LOWEST          PRIO_MAX
+#define THREAD_PRIORITY_BELOW_NORMAL    2
+#define THREAD_PRIORITY_NORMAL          0
+#define THREAD_PRIORITY_ABOVE_NORMAL    (-2)
+#endif
+
 #endif // _BITCOIN_COMPAT_H
index ae2145a3a0b0dd643c4ab7b79c223f7e1279489c..606f5a60f95ad8d3127927fdf784664ad8499e73 100644 (file)
@@ -1286,3 +1286,16 @@ std::string FormatParagraph(const std::string in, size_t width, size_t indent)
     }
     return out.str();
 }
+
+void SetThreadPriority(int nPriority)
+{
+#ifdef WIN32
+    SetThreadPriority(GetCurrentThread(), nPriority);
+#else // WIN32
+#ifdef PRIO_THREAD
+    setpriority(PRIO_THREAD, 0, nPriority);
+#else // PRIO_THREAD
+    setpriority(PRIO_PROCESS, 0, nPriority);
+#endif // PRIO_THREAD
+#endif // WIN32
+}
index 785d4056e748cde52e0a8fd563a293220caee2f3..939e59c301333688cdf355d7bb2ae108df8b6190 100644 (file)
@@ -342,34 +342,7 @@ bool TimingResistantEqual(const T& a, const T& b)
     return accumulator == 0;
 }
 
-#ifdef WIN32
-inline void SetThreadPriority(int nPriority)
-{
-    SetThreadPriority(GetCurrentThread(), nPriority);
-}
-#else
-
-// PRIO_MAX is not defined on Solaris
-#ifndef PRIO_MAX
-#define PRIO_MAX 20
-#endif
-#define THREAD_PRIORITY_LOWEST          PRIO_MAX
-#define THREAD_PRIORITY_BELOW_NORMAL    2
-#define THREAD_PRIORITY_NORMAL          0
-#define THREAD_PRIORITY_ABOVE_NORMAL    (-2)
-
-inline void SetThreadPriority(int nPriority)
-{
-    // It's unclear if it's even possible to change thread priorities on Linux,
-    // but we really and truly need it for the generation threads.
-#ifdef PRIO_THREAD
-    setpriority(PRIO_THREAD, 0, nPriority);
-#else
-    setpriority(PRIO_PROCESS, 0, nPriority);
-#endif
-}
-#endif
-
+void SetThreadPriority(int nPriority);
 void RenameThread(const char* name);
 
 // Standard wrapper for do-something-forever thread functions.
This page took 0.030105 seconds and 4 git commands to generate.