* src/misc/threads.c: Fixed a bug in handling of priorities : with POSIX
authorChristophe Massiot <massiot@videolan.org>
Fri, 22 Oct 2004 13:42:17 +0000 (13:42 +0000)
committerChristophe Massiot <massiot@videolan.org>
Fri, 22 Oct 2004 13:42:17 +0000 (13:42 +0000)
  threads a newly created thread inherits the priority of its parent.
  Set the priority even if it is 0.

src/misc/threads.c

index ceee3f7..33d3a0d 100644 (file)
@@ -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( &param, 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( &param, 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;