summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/thread/thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-runtime/lib/thread/thread.cc')
-rw-r--r--gnuradio-runtime/lib/thread/thread.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/gnuradio-runtime/lib/thread/thread.cc b/gnuradio-runtime/lib/thread/thread.cc
index 1727dc6621..d79d1a0129 100644
--- a/gnuradio-runtime/lib/thread/thread.cc
+++ b/gnuradio-runtime/lib/thread/thread.cc
@@ -97,6 +97,20 @@ namespace gr {
}
}
+ int
+ thread_priority(gr_thread_t thread)
+ {
+ // Not implemented on Windows
+ return -1;
+ }
+
+ int
+ set_thread_priority(gr_thread_t thread, int priority)
+ {
+ // Not implemented on Windows
+ return -1;
+ }
+
} /* namespace thread */
} /* namespace gr */
@@ -148,6 +162,20 @@ namespace gr {
// Not implemented on OSX
}
+ int
+ thread_priority(gr_thread_t thread)
+ {
+ // Not implemented on OSX
+ return -1;
+ }
+
+ int
+ set_thread_priority(gr_thread_t thread, int priority)
+ {
+ // Not implemented on OSX
+ return -1;
+ }
+
} /* namespace thread */
} /* namespace gr */
@@ -232,6 +260,28 @@ namespace gr {
}
}
+ int
+ thread_priority(gr_thread_t thread)
+ {
+ sched_param param;
+ int priority;
+ int policy;
+ int ret;
+ ret = pthread_getschedparam (thread, &policy, &param);
+ priority = param.sched_priority;
+ return (ret==0)?priority:ret;
+ }
+
+ int
+ set_thread_priority(gr_thread_t thread, int priority)
+ {
+ int policy;
+ struct sched_param param;
+ pthread_getschedparam (thread, &policy, &param);
+ param.sched_priority = priority;
+ return pthread_setschedparam(thread, policy, &param);
+ }
+
} /* namespace thread */
} /* namespace gr */