aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-06-17 11:32:46 -0700
committerJosh Blum <josh@joshknows.com>2010-06-17 11:32:46 -0700
commit1db016bc6503cdca76025f131773e550bd895d48 (patch)
treea888bcd269dd02a1788e0bd1d728473e5e7a65fd /host/lib
parent339aa3ccd4a50de5e259078635ddbcd552fff22f (diff)
downloaduhd-1db016bc6503cdca76025f131773e550bd895d48.tar.gz
uhd-1db016bc6503cdca76025f131773e550bd895d48.tar.bz2
uhd-1db016bc6503cdca76025f131773e550bd895d48.zip
uhd: check priority range
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/thread_priority.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/host/lib/thread_priority.cpp b/host/lib/thread_priority.cpp
index afaa5e36e..30b184123 100644
--- a/host/lib/thread_priority.cpp
+++ b/host/lib/thread_priority.cpp
@@ -46,11 +46,8 @@ static void check_priority_range(float priority){
//when realtime is not enabled, use sched other
int policy = (realtime)? SCHED_RR : SCHED_OTHER;
- //we cannot have below normal priority, set to zero and use other policy
- if (priority < 0){
- priority = 0;
- policy = SCHED_OTHER;
- }
+ //we cannot have below normal priority, set to zero
+ if (priority < 0) priority = 0;
//get the priority bounds for the selected policy
int min_pri = sched_get_priority_min(policy);
@@ -71,6 +68,8 @@ static void check_priority_range(float priority){
#include <windows.h>
void uhd::set_thread_priority(float priority, bool realtime){
+ check_priority_range(priority);
+
//set the priority class on the process
int pri_class = (realtime)? REALTIME_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS;
if (SetPriorityClass(GetCurrentProcess(), pri_class) == 0)