Fix multiple backporting errors

This commit is contained in:
lateminer
2018-10-19 00:54:22 +03:00
parent 8b2e1d8a04
commit 1874993043
6 changed files with 46 additions and 41 deletions

View File

@@ -28,6 +28,12 @@
#include <boost/signals2/signal.hpp>
#include <boost/thread/exceptions.hpp>
#ifndef WIN32
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#endif
// Application startup time (used for uptime calculation)
int64_t GetStartupTime();
@@ -219,6 +225,30 @@ std::string HelpMessageOpt(const std::string& option, const std::string& message
*/
int GetNumCores();
#ifdef WIN32
inline void SetThreadPriority(int nPriority)
{
SetThreadPriority(GetCurrentThread(), nPriority);
}
#else
#define THREAD_PRIORITY_LOWEST PRIO_MAX
#define THREAD_PRIORITY_BELOW_NORMAL 2
#define THREAD_PRIORITY_NORMAL 0
#define THREAD_PRIORITY_ABOVE_NORMAL 0
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 RenameThread(const char* name);
/**