From 67c7d4fe76892819e8dc808ebe058d480099cf5b Mon Sep 17 00:00:00 2001 From: Christophe Massiot Date: Fri, 22 Oct 2004 13:42:17 +0000 Subject: [PATCH] * src/misc/threads.c: Fixed a bug in handling of priorities : with POSIX threads a newly created thread inherits the priority of its parent. Set the priority even if it is 0. --- src/misc/threads.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/misc/threads.c b/src/misc/threads.c index ceee3f7a4a..33d3a0dd09 100644 --- a/src/misc/threads.c +++ b/src/misc/threads.c @@ -560,18 +560,16 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line, #elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) i_ret = pthread_create( &p_this->thread_id, NULL, func, p_data ); - if ( i_priority #ifndef SYS_DARWIN - && config_GetInt( p_this, "rt-priority" ) + if ( config_GetInt( p_this, "rt-priority" ) ) #endif - ) { int i_error, i_policy; struct sched_param param; memset( ¶m, 0, sizeof(struct sched_param) ); i_priority += config_GetInt( p_this, "rt-offset" ); - if ( i_priority < 0 ) + if ( i_priority <= 0 ) { param.sched_priority = (-1) * i_priority; i_policy = SCHED_OTHER; @@ -647,18 +645,16 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, char * psz_file, } #elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) - if ( i_priority #ifndef SYS_DARWIN - && config_GetInt( p_this, "rt-priority" ) + if ( config_GetInt( p_this, "rt-priority" ) ) #endif - ) { int i_error, i_policy; struct sched_param param; memset( ¶m, 0, sizeof(struct sched_param) ); i_priority += config_GetInt( p_this, "rt-offset" ); - if ( i_priority < 0 ) + if ( i_priority <= 0 ) { param.sched_priority = (-1) * i_priority; i_policy = SCHED_OTHER; -- 2.39.2