From 1db016bc6503cdca76025f131773e550bd895d48 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 17 Jun 2010 11:32:46 -0700 Subject: uhd: check priority range --- host/lib/thread_priority.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'host/lib/thread_priority.cpp') 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 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) -- cgit v1.2.3