From 230bccb2dcdaed84ce9820b13c4dc1f58eacb13a Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 8 Jun 2012 11:15:29 +0300 Subject: Fix utilization of _POSIX_THREAD_PRIORITY_SCHEDULING macro A POSIX compliant OS can have a setting of (-1) instead of say 200112L to indicate that the OS does not implement the feature. The code as it is would still attempt to utilize the functions if (-1) were being set and fail to build. --- src/xine-engine/audio_decoder.c | 4 ++-- src/xine-engine/audio_out.c | 2 +- src/xine-engine/video_decoder.c | 4 ++-- src/xine-engine/video_out.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 10c20f231..cf8e1ca5e 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.c @@ -466,7 +466,7 @@ static void *audio_decoder_loop (void *stream_gen) { int _x_audio_decoder_init (xine_stream_t *stream) { pthread_attr_t pth_attrs; -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) struct sched_param pth_params; #endif int err; @@ -506,7 +506,7 @@ int _x_audio_decoder_init (xine_stream_t *stream) { */ pthread_attr_init(&pth_attrs); -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) pthread_attr_getschedparam(&pth_attrs, &pth_params); pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER); pthread_attr_setschedparam(&pth_attrs, &pth_params); diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index b9738595b..033421552 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -2284,7 +2284,7 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, this->audio_loop_running = 1; pthread_attr_init(&pth_attrs); -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM); #endif diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index 8e8502968..c52ebdc89 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.c @@ -518,7 +518,7 @@ int _x_video_decoder_init (xine_stream_t *stream) { } else { pthread_attr_t pth_attrs; -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) struct sched_param pth_params; #endif int err, num_buffers; @@ -549,7 +549,7 @@ int _x_video_decoder_init (xine_stream_t *stream) { stream->spu_track_map_entries = 0; pthread_attr_init(&pth_attrs); -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) pthread_attr_getschedparam(&pth_attrs, &pth_params); pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER); pthread_attr_setschedparam(&pth_attrs, &pth_params); diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index a6d39f23f..b2fdb7ef9 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -1948,7 +1948,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon this->grab_only = 0; pthread_attr_init(&pth_attrs); -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0) pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM); #endif -- cgit v1.2.3