@@ -5881,22 +5881,21 @@ bool RtApiAlsa :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne | |||||
pthread_attr_t attr; | pthread_attr_t attr; | ||||
pthread_attr_init( &attr ); | pthread_attr_init( &attr ); | ||||
pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE ); | pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE ); | ||||
#ifdef SCHED_RR // Undefined with some OSes (eg: NetBSD 1.6.x with GNU Pthread) | #ifdef SCHED_RR // Undefined with some OSes (eg: NetBSD 1.6.x with GNU Pthread) | ||||
if ( options && options->flags & RTAUDIO_SCHEDULE_REALTIME ) { | if ( options && options->flags & RTAUDIO_SCHEDULE_REALTIME ) { | ||||
struct sched_param param; | |||||
// We previously attempted to increase the audio callback priority | |||||
// to SCHED_RR here via the attributes. However, while no errors | |||||
// were reported in doing so, it did not work. So, now this is | |||||
// done in the alsaCallbackHandler function. | |||||
stream_.callbackInfo.doRealtime = true; | |||||
int priority = options->priority; | int priority = options->priority; | ||||
int min = sched_get_priority_min( SCHED_RR ); | int min = sched_get_priority_min( SCHED_RR ); | ||||
int max = sched_get_priority_max( SCHED_RR ); | int max = sched_get_priority_max( SCHED_RR ); | ||||
if ( priority < min ) priority = min; | if ( priority < min ) priority = min; | ||||
else if ( priority > max ) priority = max; | else if ( priority > max ) priority = max; | ||||
param.sched_priority = priority; | |||||
pthread_attr_setschedpolicy( &attr, SCHED_RR ); | |||||
pthread_attr_setschedparam( &attr, ¶m ); | |||||
stream_.callbackInfo.priority = priority; | |||||
} | } | ||||
else | |||||
pthread_attr_setschedpolicy( &attr, SCHED_OTHER ); | |||||
#else | |||||
pthread_attr_setschedpolicy( &attr, SCHED_OTHER ); | |||||
#endif | #endif | ||||
stream_.callbackInfo.isRunning = true; | stream_.callbackInfo.isRunning = true; | ||||
@@ -6314,6 +6313,14 @@ extern "C" void *alsaCallbackHandler( void *ptr ) | |||||
RtApiAlsa *object = (RtApiAlsa *) info->object; | RtApiAlsa *object = (RtApiAlsa *) info->object; | ||||
bool *isRunning = &info->isRunning; | bool *isRunning = &info->isRunning; | ||||
#ifdef SCHED_RR // Undefined with some OSes (eg: NetBSD 1.6.x with GNU Pthread) | |||||
if ( &info->doRealtime ) { | |||||
pthread_t tID = pthread_self(); // ID of this thread | |||||
sched_param prio = { info->priority }; // scheduling priority of thread | |||||
pthread_setschedparam( tID, SCHED_RR, &prio ); | |||||
} | |||||
#endif | |||||
while ( *isRunning == true ) { | while ( *isRunning == true ) { | ||||
pthread_testcancel(); | pthread_testcancel(); | ||||
object->callbackEvent(); | object->callbackEvent(); | ||||
@@ -537,10 +537,12 @@ struct CallbackInfo { | |||||
void *userData; | void *userData; | ||||
void *apiInfo; // void pointer for API specific callback information | void *apiInfo; // void pointer for API specific callback information | ||||
bool isRunning; | bool isRunning; | ||||
bool doRealtime; | |||||
int priority; | |||||
// Default constructor. | // Default constructor. | ||||
CallbackInfo() | CallbackInfo() | ||||
:object(0), callback(0), userData(0), apiInfo(0), isRunning(false) {} | |||||
:object(0), callback(0), userData(0), apiInfo(0), isRunning(false), doRealtime(false) {} | |||||
}; | }; | ||||
// **************************************************************** // | // **************************************************************** // | ||||
@@ -3,7 +3,7 @@ | |||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 | ||||
# Free Software Foundation, Inc. | # Free Software Foundation, Inc. | ||||
timestamp='2004-02-26' | |||||
timestamp='2012-11-19' | |||||
# This file is (in principle) common to ALL GNU software. | # This file is (in principle) common to ALL GNU software. | ||||
# The presence of a machine in this file suggests that SOME GNU software | # The presence of a machine in this file suggests that SOME GNU software | ||||
@@ -225,7 +225,7 @@ case $basic_machine in | |||||
| alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ | | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ | ||||
| alphaev6[78] \ | | alphaev6[78] \ | ||||
| we32k | ns16k | clipper | i370 | sh | sh[34] \ | | we32k | ns16k | clipper | i370 | sh | sh[34] \ | ||||
| powerpc | powerpcle \ | |||||
| powerpc | powerpc64 | powerpcle \ | |||||
| 1750a | dsp16xx | pdp10 | pdp11 \ | | 1750a | dsp16xx | pdp10 | pdp11 \ | ||||
| mips16 | mips64 | mipsel | mips64el \ | | mips16 | mips64 | mipsel | mips64el \ | ||||
| mips64orion | mips64orionel | mipstx39 | mipstx39el \ | | mips64orion | mips64orionel | mipstx39 | mipstx39el \ | ||||
@@ -271,7 +271,7 @@ case $basic_machine in | |||||
| alphaev6[78]-* \ | | alphaev6[78]-* \ | ||||
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ | | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ | ||||
| clipper-* | orion-* \ | | clipper-* | orion-* \ | ||||
| sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ | |||||
| sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpc64-* | powerpcle-* \ | |||||
| sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ | | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ | ||||
| mips16-* | mips64-* | mipsel-* \ | | mips16-* | mips64-* | mipsel-* \ | ||||
| mips64el-* | mips64orion-* | mips64orionel-* \ | | mips64el-* | mips64orion-* | mips64orionel-* \ | ||||
@@ -721,6 +721,10 @@ case $basic_machine in | |||||
;; | ;; | ||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` | ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` | ||||
;; | ;; | ||||
ppc64) basic_machine=powerpc64-unknown | |||||
;; | |||||
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` | |||||
;; | |||||
ppcle | powerpclittle | ppc-le | powerpc-little) | ppcle | powerpclittle | ppc-le | powerpc-little) | ||||
basic_machine=powerpcle-unknown | basic_machine=powerpcle-unknown | ||||
;; | ;; | ||||