[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6425 - gnuradio/branches/developers/michaelld/mc_and_
From: |
michaelld |
Subject: |
[Commit-gnuradio] r6425 - gnuradio/branches/developers/michaelld/mc_and_rt/gnuradio-core/src/lib/runtime |
Date: |
Thu, 13 Sep 2007 14:02:43 -0600 (MDT) |
Author: michaelld
Date: 2007-09-13 14:02:43 -0600 (Thu, 13 Sep 2007)
New Revision: 6425
Modified:
gnuradio/branches/developers/michaelld/mc_and_rt/gnuradio-core/src/lib/runtime/gr_realtime.cc
Log:
Fix to make realtime using 'pthread_setschedparam' equivalent to that
provided by 'sched_setscheduler'.
Modified:
gnuradio/branches/developers/michaelld/mc_and_rt/gnuradio-core/src/lib/runtime/gr_realtime.cc
===================================================================
---
gnuradio/branches/developers/michaelld/mc_and_rt/gnuradio-core/src/lib/runtime/gr_realtime.cc
2007-09-13 18:45:31 UTC (rev 6424)
+++
gnuradio/branches/developers/michaelld/mc_and_rt/gnuradio-core/src/lib/runtime/gr_realtime.cc
2007-09-13 20:02:43 UTC (rev 6425)
@@ -65,23 +65,14 @@
gr_rt_status_t
gr_enable_realtime_scheduling()
{
- int policy = 0;
- int pri = 0;
+ int policy = SCHED_FIFO;
+ int pri = (sched_get_priority_max (policy) +
+ sched_get_priority_min (policy)) / 2;
pthread_t this_thread = pthread_self (); // this process
struct sched_param param;
memset (¶m, 0, sizeof (param));
param.sched_priority = pri;
- int result = pthread_getschedparam (this_thread, &policy, ¶m);
- if (result == 0) { // good results
- // set the priority half-way between the default and maximum
- pri = (sched_get_priority_max (policy) + param.sched_priority) / 2;
-
- int policy = SCHED_FIFO; // desired policy
- struct sched_param param;
- memset (¶m, 0, sizeof (struct sched_param));
- param.sched_priority = pri;
- result = pthread_setschedparam (this_thread, policy, ¶m);
- }
+ int result = pthread_setschedparam (this_thread, policy, ¶m);
if (result != 0) {
if (errno == EPERM)
return RT_NO_PRIVS;
@@ -90,7 +81,7 @@
return RT_OTHER_ERROR;
}
}
- // printf ("SCHED_FIFO enabled with priority = %d\n", pri);
+ printf("SCHED_FIFO enabled with priority = %d\n", pri);
return RT_OK;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6425 - gnuradio/branches/developers/michaelld/mc_and_rt/gnuradio-core/src/lib/runtime,
michaelld <=