Skip to content

Commit

Permalink
Fix a build error
Browse files Browse the repository at this point in the history
  • Loading branch information
hham committed Oct 15, 2015
1 parent 419e909 commit e399eea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/autowiring/CoreThreadLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void BasicThread::SetThreadPriority(ThreadPriority threadPriority) {
struct sched_param param = { 0 };
int policy = SCHED_RR;
int percent = 0;
int min_priority;

switch (threadPriority) {
case ThreadPriority::Idle:
Expand Down Expand Up @@ -57,7 +58,8 @@ void BasicThread::SetThreadPriority(ThreadPriority threadPriority) {
default:
throw std::runtime_error("Attempted to assign an unrecognized thread priority");
}
param.sched_priority = sched_get_priority_min() + (percent*(sched_get_priority_max() - sched_get_priority_min()) + 50) / 100;
min_priority = sched_get_priority_min(policy);
param.sched_priority = min_priority + (percent * (sched_get_priority_max(policy) - min_priority) + 50) / 100;

pthread_setschedparam(m_state->m_thisThread.native_handle(), policy, &param);
}

0 comments on commit e399eea

Please sign in to comment.