From: <jpg...@us...> - 2008-07-02 22:40:58
|
Revision: 1446 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1446&view=rev Author: jpgrayson Date: 2008-07-02 15:41:06 -0700 (Wed, 02 Jul 2008) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/lib/unixfuncs.c Modified: trunk/lib/unixfuncs.c =================================================================== --- trunk/lib/unixfuncs.c 2008-07-02 22:37:01 UTC (rev 1445) +++ trunk/lib/unixfuncs.c 2008-07-02 22:41:06 UTC (rev 1446) @@ -215,10 +215,12 @@ static int WatchDogProc(struct prioboost *b ) { - struct sched_param schp = { 0 }; + struct sched_param schp = { 0 }; + struct sched_param schat = { 0 }; - /* 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. */ + /* 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; if( schp.sched_priority > b->max_priority ) schp.sched_priority = b->max_priority; @@ -229,16 +231,16 @@ goto killAudio; } - DBUG("prioboost: WatchDog priority set to level %d!\n", schp.sched_priority); + DBUG("prioboost: WatchDog priority set to level %d!\n", + schp.sched_priority); /* Compare watchdog time with audio and canary thread times. */ /* Sleep for a while or until thread cancelled. */ - while( b->WatchDogRun ) + while ( b->WatchDogRun ) { + int delta; + struct timeval currentTime; - int delta; - struct timeval currentTime; - usleep( WATCHDOG_INTERVAL_USEC ); gettimeofday( ¤tTime, NULL ); @@ -266,19 +268,18 @@ return 0; lowerAudio: + if ( pthread_setschedparam(b->ThreadID, SCHED_OTHER, &schat) != 0 ) { - struct sched_param schat = { 0 }; - if( pthread_setschedparam(b->ThreadID, SCHED_OTHER, &schat) != 0) - { - ERR_RPT("WatchDogProc: failed to lower audio priority. errno = %d\n", errno ); - /* Fall through into killing audio thread. */ - } - else - { - ERR_RPT("WatchDogProc: lowered audio priority to prevent hogging of CPU.\n"); - goto cleanup; - } + ERR_RPT("WatchDogProc: failed to lower audio priority. " + "errno = %d\n", errno); + /* Fall through into killing audio thread. */ } + else + { + ERR_RPT("WatchDogProc: lowered audio priority to prevent " + "hogging of CPU.\n"); + goto cleanup; + } killAudio: ERR_RPT("WatchDogProc: killing hung audio thread!\n"); @@ -366,8 +367,8 @@ int iaxci_prioboostbegin() { - struct sched_param schp = { 0 }; - struct prioboost *b = calloc(sizeof(*b),1); + struct sched_param schp = { 0 }; + struct prioboost *b = calloc(1, sizeof(*b)); int result = 0; @@ -384,13 +385,18 @@ } else { - DBUG("prioboost: priority set to level %d!\n", schp.sched_priority); /* We are running at high priority so we should have a watchdog in case audio goes wild. */ + DBUG("prioboost: priority set to level %d!\n", schp.sched_priority); + /* We are running at high priority so we should have a watchdog + * in case audio goes wild. */ result = StartWatchDog( b ); } - if(result == 0) { + if (result == 0) + { pb = b; - } else { + } + else + { pb = NULL; schp.sched_priority = 0; pthread_setschedparam(b->ThreadID, SCHED_OTHER, &schp); @@ -401,7 +407,8 @@ int iaxci_prioboostend() { - if(pb) StopWatchDog(pb); + if ( pb ) + StopWatchDog(pb); return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |