Commit 33c8a14f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Do not set a priority for non-realtime threads

Contrary to process priority increment ("niceness"), thread priority
increment increase in the priority of the thread. So multiplying
negative priorities with -1 was totally wrong here.

On Linux, there is only one non-realtime (SCHED_OTHER) priority, 0, so
the code was failing safe silently. Don't know on other systems.
parent 2efddef0
...@@ -517,11 +517,7 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line ...@@ -517,11 +517,7 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line
if( config_GetType( p_this, "rt-offset" ) ) 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 )
{
struct sched_param param = { .sched_priority = -i_priority, };
pthread_attr_setschedpolicy (&attr, SCHED_OTHER); pthread_attr_setschedpolicy (&attr, SCHED_OTHER);
pthread_attr_setschedparam (&attr, &param);
}
else else
{ {
struct sched_param param = { .sched_priority = +i_priority, }; struct sched_param param = { .sched_priority = +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