summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreb2008-09-22 21:53:29 +0000
committereb2008-09-22 21:53:29 +0000
commit20f913ec2e71888a451250ba841c980638221c65 (patch)
treeca74bc06fe143fc121a501b6013b5633c239e17b
parentc77463ef0bdb7ef7857c0e78b2821ff03796ccc0 (diff)
downloadgnuradio-20f913ec2e71888a451250ba841c980638221c65.tar.gz
gnuradio-20f913ec2e71888a451250ba841c980638221c65.tar.bz2
gnuradio-20f913ec2e71888a451250ba841c980638221c65.zip
fixed copy/paste problem and error handling
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9639 221aa14e-8319-0410-a670-987f0aec2ac5
-rw-r--r--gruel/src/lib/realtime.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/gruel/src/lib/realtime.cc b/gruel/src/lib/realtime.cc
index 1de8b6dc0..d1907b3c1 100644
--- a/gruel/src/lib/realtime.cc
+++ b/gruel/src/lib/realtime.cc
@@ -70,19 +70,20 @@ namespace gruel {
{
int policy = p.policy == RT_SCHED_FIFO ? SCHED_FIFO : SCHED_RR;
int min_real_pri = sched_get_priority_min(policy);
- int max_real_pri = sched_get_priority_min(policy);
+ int max_real_pri = sched_get_priority_max(policy);
int pri = rescale_virtual_pri(p.priority, min_real_pri, max_real_pri);
- pthread_t this_thread = pthread_self (); // this process
struct sched_param param;
memset (&param, 0, sizeof (param));
param.sched_priority = pri;
- int result = pthread_setschedparam (this_thread, policy, &param);
+ int result = pthread_setschedparam (pthread_self(), policy, &param);
if (result != 0) {
- if (errno == EPERM)
+ if (result == EPERM) // N.B., return value, not errno
return RT_NO_PRIVS;
else {
- perror ("pthread_setschedparam: failed to set real time priority");
+ fprintf(stderr,
+ "pthread_setschedparam: failed to set real time priority: %s\n",
+ strerror(result));
return RT_OTHER_ERROR;
}
}
@@ -102,7 +103,7 @@ namespace gruel {
{
int policy = p.policy == RT_SCHED_FIFO ? SCHED_FIFO : SCHED_RR;
int min_real_pri = sched_get_priority_min(policy);
- int max_real_pri = sched_get_priority_min(policy);
+ int max_real_pri = sched_get_priority_max(policy);
int pri = rescale_virtual_pri(p.priority, min_real_pri, max_real_pri);
int pid = 0; // this process