Changeset 872bfb52d2563c38c8fe3f4c831d2503d3f3a104
- 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
| rfbb8255 |
r872bfb5 |
|
| 59 | 59 | /* Thread priorities */ |
|---|
| 60 | 60 | #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 |
|---|
| 67 | 67 | |
|---|
| 68 | 68 | #elif defined(SYS_BEOS) |
|---|
| raa47b16 |
r872bfb5 |
|
| 516 | 516 | #endif |
|---|
| 517 | 517 | { |
|---|
| | 518 | struct sched_param p = { .sched_priority = i_priority, }; |
|---|
| | 519 | int policy; |
|---|
| | 520 | |
|---|
| 518 | 521 | /* Hack to avoid error msg */ |
|---|
| 519 | 522 | 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); |
|---|
| 523 | 526 | 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, ¶m); |
|---|
| 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); |
|---|
| 531 | 531 | } |
|---|
| 532 | 532 | |
|---|