Add missing _POSIX_THREAD_PRIORITY_SCHEDULING checks.

from Brad
This commit is contained in:
ajacoutot 2012-05-19 06:04:22 +00:00
parent 8cfa476c9a
commit bdc06434d1
2 changed files with 42 additions and 2 deletions

View File

@ -1,8 +1,8 @@
# $OpenBSD: Makefile,v 1.9 2010/09/06 00:04:28 sthen Exp $
# $OpenBSD: Makefile,v 1.10 2012/05/19 06:04:22 ajacoutot Exp $
COMMENT= portable cross-platform audio API
DISTNAME= portaudio-svn-1406
REVISION= 1
REVISION= 2
SHARED_LIBS= portaudio 1.0

View File

@ -0,0 +1,40 @@
$OpenBSD: patch-src_os_unix_pa_unix_util_c,v 1.1 2012/05/19 06:04:22 ajacoutot Exp $
--- src/os/unix/pa_unix_util.c.orig Wed May 16 20:58:26 2012
+++ src/os/unix/pa_unix_util.c Wed May 16 21:06:25 2012
@@ -218,6 +218,7 @@ static PaError BoostPriority( PaUnixThread* self )
assert( self );
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULINGG) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0)
if( pthread_setschedparam( self->thread, SCHED_FIFO, &spm ) != 0 )
{
PA_UNLESS( errno == EPERM, paInternalError ); /* Lack permission to raise priority */
@@ -228,6 +229,7 @@ static PaError BoostPriority( PaUnixThread* self )
{
result = 1; /* Success */
}
+#endif
error:
return result;
}
@@ -266,8 +268,10 @@ PaError PaUnixThread_New( PaUnixThread* self, void* (*
#endif
PA_UNLESS( !pthread_attr_init( &attr ), paInternalError );
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0)
/* Priority relative to other processes */
PA_UNLESS( !pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ), paInternalError );
+#endif
PA_UNLESS( !pthread_create( &self->thread, &attr, threadFunc, threadArg ), paInternalError );
started = 1;
@@ -314,7 +318,9 @@ PaError PaUnixThread_New( PaUnixThread* self, void* (*
{
int policy;
struct sched_param spm;
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0)
pthread_getschedparam(self->thread, &policy, &spm);
+#endif
}
}