|
From: <jpg...@us...> - 2008-07-02 22:36:58
|
Revision: 1445
http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1445&view=rev
Author: jpgrayson
Date: 2008-07-02 15:37:01 -0700 (Wed, 02 Jul 2008)
Log Message:
-----------
Cache min and max priority values in struct prioboost.
Modified Paths:
--------------
trunk/lib/unixfuncs.c
Modified: trunk/lib/unixfuncs.c
===================================================================
--- trunk/lib/unixfuncs.c 2008-07-02 22:34:14 UTC (rev 1444)
+++ trunk/lib/unixfuncs.c 2008-07-02 22:37:01 UTC (rev 1445)
@@ -177,6 +177,9 @@
struct prioboost
{
int priority;
+ int min_priority;
+ int max_priority;
+
pthread_t ThreadID;
struct timeval CanaryTime;
@@ -213,13 +216,12 @@
static int WatchDogProc(struct prioboost *b )
{
struct sched_param schp = { 0 };
- int maxPri;
/* Run at a priority level above main thread so we can still run if it hangs. */
/* Rise more than 1 because of rumored off-by-one scheduler bugs. */
schp.sched_priority = b->priority + 4;
- maxPri = sched_get_priority_max(SCHEDULER_POLICY);
- if( schp.sched_priority > maxPri ) schp.sched_priority = maxPri;
+ if( schp.sched_priority > b->max_priority )
+ schp.sched_priority = b->max_priority;
if (pthread_setschedparam(pthread_self(), SCHEDULER_POLICY, &schp) != 0)
{
@@ -369,8 +371,9 @@
int result = 0;
- b->priority = (sched_get_priority_max(SCHEDULER_POLICY) -
- sched_get_priority_min(SCHEDULER_POLICY)) / 2;
+ b->min_priority = sched_get_priority_min(SCHEDULER_POLICY);
+ b->max_priority = sched_get_priority_max(SCHEDULER_POLICY);
+ b->priority = (b->max_priority - b->min_priority) / 2;
schp.sched_priority = b->priority;
b->ThreadID = pthread_self();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|