Skip to content

Commit

Permalink
don't run ThreadMessageHandler at lowered priority
Browse files Browse the repository at this point in the history
There's no clear reason ThreadMessageHandler should be low priority.
Fixes bitcoin#8010 (priority inversion).
  • Loading branch information
kazcw committed May 5, 2016
1 parent 3b9a0bf commit e53e7c5
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 26 deletions.
11 changes: 0 additions & 11 deletions src/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,6 @@ typedef u_int SOCKET;
#define MSG_NOSIGNAL 0
#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

#if HAVE_DECL_STRNLEN == 0
size_t strnlen( const char *start, size_t max_len);
#endif // HAVE_DECL_STRNLEN
Expand Down
1 change: 0 additions & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,6 @@ void ThreadMessageHandler()
boost::mutex condition_mutex;
boost::unique_lock<boost::mutex> lock(condition_mutex);

SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL);
while (true)
{
vector<CNode*> vNodesCopy;
Expand Down
13 changes: 0 additions & 13 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,19 +790,6 @@ bool SetupNetworking()
return true;
}

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
}

int GetNumCores()
{
#if BOOST_VERSION >= 105600
Expand Down
1 change: 0 additions & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ std::string HelpMessageOpt(const std::string& option, const std::string& message
*/
int GetNumCores();

void SetThreadPriority(int nPriority);
void RenameThread(const char* name);

/**
Expand Down

0 comments on commit e53e7c5

Please sign in to comment.