2 * Copyright 2004-2010, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Jérôme Duval, korli@users.sourceforge.net.
7 * Michael Pfeiffer, laplace@users.sourceforge.net
11 #include <scheduler.h>
19 } sWhatPriorityArray
[] = {
20 // highest priority first
21 {B_MIDI_PROCESSING
, 0x78},
22 {B_AUDIO_RECORDING
| B_AUDIO_PLAYBACK
, 0x73},
23 {B_LIVE_AUDIO_MANIPULATION
, 0x6e},
24 {B_VIDEO_RECORDING
, 0x19},
25 {B_VIDEO_PLAYBACK
, 0x14},
26 {B_USER_INPUT_HANDLING
, 0x0f},
27 {B_LIVE_VIDEO_MANIPULATION
, 0x0e},
28 {B_LIVE_3D_RENDERING
, 0x0c},
29 {B_STATUS_RENDERING
, 0xa},
30 {B_OFFLINE_PROCESSING
, 0x06},
31 {B_NUMBER_CRUNCHING
, 0x05},
35 status_t
__set_scheduler_mode(int32 mode
);
36 int32
__get_scheduler_mode(void);
40 suggest_thread_priority(uint32 what
, int32 period
, bigtime_t jitter
,
44 int32 priority
= what
== B_DEFAULT_MEDIA_PRIORITY
? 0x0a : 0;
47 // TODO: this needs kernel support, and is a pretty simplistic solution
49 for (i
= 0; sWhatPriorityArray
[i
].what
!= (uint32
)-1; i
++) {
50 if ((what
& sWhatPriorityArray
[i
].what
) != 0) {
51 priority
= sWhatPriorityArray
[i
].priority
;
61 estimate_max_scheduling_latency(thread_id thread
)
63 return _kern_estimate_max_scheduling_latency(thread
);
68 __set_scheduler_mode(int32 mode
)
70 return _kern_set_scheduler_mode(mode
);
75 __get_scheduler_mode(void)
77 return _kern_get_scheduler_mode();
81 B_DEFINE_WEAK_ALIAS(__set_scheduler_mode
, set_scheduler_mode
);
82 B_DEFINE_WEAK_ALIAS(__get_scheduler_mode
, get_scheduler_mode
);