Commit 67c7d4fe authored by Christophe Massiot's avatar Christophe Massiot

* 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.
parent bef75ae8
...@@ -560,18 +560,16 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line, ...@@ -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 ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_create( &p_this->thread_id, NULL, func, p_data ); i_ret = pthread_create( &p_this->thread_id, NULL, func, p_data );
if ( i_priority
#ifndef SYS_DARWIN #ifndef SYS_DARWIN
&& config_GetInt( p_this, "rt-priority" ) if ( config_GetInt( p_this, "rt-priority" ) )
#endif #endif
)
{ {
int i_error, i_policy; int i_error, i_policy;
struct sched_param param; struct sched_param param;
memset( &param, 0, sizeof(struct sched_param) ); memset( &param, 0, sizeof(struct sched_param) );
i_priority += config_GetInt( p_this, "rt-offset" ); i_priority += config_GetInt( p_this, "rt-offset" );
if ( i_priority < 0 ) if ( i_priority <= 0 )
{ {
param.sched_priority = (-1) * i_priority; param.sched_priority = (-1) * i_priority;
i_policy = SCHED_OTHER; i_policy = SCHED_OTHER;
...@@ -647,18 +645,16 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, char * psz_file, ...@@ -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 ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
if ( i_priority
#ifndef SYS_DARWIN #ifndef SYS_DARWIN
&& config_GetInt( p_this, "rt-priority" ) if ( config_GetInt( p_this, "rt-priority" ) )
#endif #endif
)
{ {
int i_error, i_policy; int i_error, i_policy;
struct sched_param param; struct sched_param param;
memset( &param, 0, sizeof(struct sched_param) ); memset( &param, 0, sizeof(struct sched_param) );
i_priority += config_GetInt( p_this, "rt-offset" ); i_priority += config_GetInt( p_this, "rt-offset" );
if ( i_priority < 0 ) if ( i_priority <= 0 )
{ {
param.sched_priority = (-1) * i_priority; param.sched_priority = (-1) * i_priority;
i_policy = SCHED_OTHER; i_policy = SCHED_OTHER;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment