Commit e9c803a1 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Thanks to Meuuh for the feedback. threads prioritization should work now,...

* Thanks to Meuuh for the feedback. threads prioritization should work now, without annoying error messages.
* If an rt-offset is specified, then this offset is not applied to the main thread, because it's value cannot yet be retrieved at that time (same as before, but now without annoying error).
parent 0894ff44
...@@ -1253,11 +1253,7 @@ vlc_module_begin(); ...@@ -1253,11 +1253,7 @@ vlc_module_begin();
add_bool( "minimize-threads", 0, NULL, MINIMIZE_THREADS_TEXT, add_bool( "minimize-threads", 0, NULL, MINIMIZE_THREADS_TEXT,
MINIMIZE_THREADS_LONGTEXT, VLC_TRUE ); MINIMIZE_THREADS_LONGTEXT, VLC_TRUE );
/* Always set prio's on Darwin */ #if !defined(SYS_DARWIN) && !defined(SYS_BEOS) && defined(PTHREAD_COND_T_IN_PTHREAD_H)
#if defined(SYS_DARWIN)
add_bool( "rt-priority", VLC_TRUE, NULL, RT_PRIORITY_TEXT,
RT_PRIORITY_LONGTEXT, VLC_TRUE );
#elif !defined(SYS_BEOS) && defined(PTHREAD_COND_T_IN_PTHREAD_H)
add_bool( "rt-priority", VLC_FALSE, NULL, RT_PRIORITY_TEXT, add_bool( "rt-priority", VLC_FALSE, NULL, RT_PRIORITY_TEXT,
RT_PRIORITY_LONGTEXT, VLC_TRUE ); RT_PRIORITY_LONGTEXT, VLC_TRUE );
#endif #endif
......
...@@ -571,13 +571,18 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line, ...@@ -571,13 +571,18 @@ 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( config_GetType( p_this, "rt-priority" ) && config_GetInt( p_this, "rt-priority" ) ) #ifndef SYS_DARWIN
if( config_GetInt( p_this, "rt-priority" ) )
#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) );
if( config_GetType( p_this, "rt-offset" ) )
{
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;
...@@ -596,10 +601,12 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line, ...@@ -596,10 +601,12 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
i_priority = 0; i_priority = 0;
} }
} }
#ifndef SYS_DARWIN
else else
{ {
i_priority = 0; i_priority = 0;
} }
#endif
#elif defined( HAVE_CTHREADS_H ) #elif defined( HAVE_CTHREADS_H )
p_this->thread_id = cthread_fork( (cthread_fn_t)func, (any_t)p_data ); p_this->thread_id = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
...@@ -654,13 +661,18 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, char * psz_file, ...@@ -654,13 +661,18 @@ 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( config_GetType( p_this, "rt-priority" ) && config_GetInt( p_this, "rt-priority" ) ) #ifndef SYS_DARWIN
if( config_GetInt( p_this, "rt-priority" ) )
#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) );
if( config_GetType( p_this, "rt-offset" ) )
{
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;
......
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