Changeset 872bfb52d2563c38c8fe3f4c831d2503d3f3a104

Show
Ignore:
Timestamp:
06/06/08 18:34:03 (3 months ago)
Author:
Rémi Denis-Courmont <rdenis@simphalempin.com>
git-committer:
Rémi Denis-Courmont <rdenis@simphalempin.com> 1212770043 +0300
git-parent:

[fbb8255dcf8ced858d59927cb17c4f577a8d9c15]

git-author:
Rémi Denis-Courmont <rdenis@simphalempin.com> 1212770043 +0300
Message:

Force thread priorities in the supported range

(assuming rt-offset is zero)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_threads.h

    rfbb8255 r872bfb5  
    5959/* Thread priorities */ 
    6060#ifdef __APPLE__ 
    61 #   define VLC_THREAD_PRIORITY_LOW (-47) 
    62 #   define VLC_THREAD_PRIORITY_INPUT 37 
    63 #   define VLC_THREAD_PRIORITY_AUDIO 37 
    64 #   define VLC_THREAD_PRIORITY_VIDEO (-47) 
    65 #   define VLC_THREAD_PRIORITY_OUTPUT 37 
    66 #   define VLC_THREAD_PRIORITY_HIGHEST 37 
     61#   define VLC_THREAD_PRIORITY_LOW      0 
     62#   define VLC_THREAD_PRIORITY_INPUT   22 
     63#   define VLC_THREAD_PRIORITY_AUDIO   22 
     64#   define VLC_THREAD_PRIORITY_VIDEO    0 
     65#   define VLC_THREAD_PRIORITY_OUTPUT 22 
     66#   define VLC_THREAD_PRIORITY_HIGHEST 22 
    6767 
    6868#elif defined(SYS_BEOS) 
  • src/misc/threads.c

    raa47b16 r872bfb5  
    516516#endif 
    517517    { 
     518        struct sched_param p = { .sched_priority = i_priority, }; 
     519        int policy; 
     520 
    518521        /* Hack to avoid error msg */ 
    519522        if( config_GetType( p_this, "rt-offset" ) ) 
    520             i_priority += config_GetInt( p_this, "rt-offset" ); 
    521         if( i_priority <= 0 ) 
    522             pthread_attr_setschedpolicy (&attr, SCHED_OTHER); 
     523            p.sched_priority += config_GetInt( p_this, "rt-offset" ); 
     524        if( p.sched_priority <= 0 ) 
     525            p.sched_priority += sched_get_priority_max (policy = SCHED_OTHER); 
    523526        else 
    524         { 
    525             struct sched_param param = { .sched_priority = i_priority, }; 
    526  
    527             param.sched_priority += sched_get_priority_min (SCHED_RR); 
    528             pthread_attr_setschedpolicy (&attr, SCHED_RR); 
    529             pthread_attr_setschedparam (&attr, &param); 
    530         } 
     527            p.sched_priority += sched_get_priority_min (policy = SCHED_RR); 
     528 
     529        pthread_attr_setschedpolicy (&attr, policy); 
     530        pthread_attr_setschedparam (&attr, &p); 
    531531    } 
    532532