3294 |
3294 |
3295 // Win32 only gives you access to seven real priorities at a time, |
3295 // Win32 only gives you access to seven real priorities at a time, |
3296 // so we compress Java's ten down to seven. It would be better |
3296 // so we compress Java's ten down to seven. It would be better |
3297 // if we dynamically adjusted relative priorities. |
3297 // if we dynamically adjusted relative priorities. |
3298 |
3298 |
3299 int os::java_to_os_priority[MaxPriority + 1] = { |
3299 int os::java_to_os_priority[CriticalPriority + 1] = { |
3300 THREAD_PRIORITY_IDLE, // 0 Entry should never be used |
3300 THREAD_PRIORITY_IDLE, // 0 Entry should never be used |
3301 THREAD_PRIORITY_LOWEST, // 1 MinPriority |
3301 THREAD_PRIORITY_LOWEST, // 1 MinPriority |
3302 THREAD_PRIORITY_LOWEST, // 2 |
3302 THREAD_PRIORITY_LOWEST, // 2 |
3303 THREAD_PRIORITY_BELOW_NORMAL, // 3 |
3303 THREAD_PRIORITY_BELOW_NORMAL, // 3 |
3304 THREAD_PRIORITY_BELOW_NORMAL, // 4 |
3304 THREAD_PRIORITY_BELOW_NORMAL, // 4 |
3305 THREAD_PRIORITY_NORMAL, // 5 NormPriority |
3305 THREAD_PRIORITY_NORMAL, // 5 NormPriority |
3306 THREAD_PRIORITY_NORMAL, // 6 |
3306 THREAD_PRIORITY_NORMAL, // 6 |
3307 THREAD_PRIORITY_ABOVE_NORMAL, // 7 |
3307 THREAD_PRIORITY_ABOVE_NORMAL, // 7 |
3308 THREAD_PRIORITY_ABOVE_NORMAL, // 8 |
3308 THREAD_PRIORITY_ABOVE_NORMAL, // 8 |
3309 THREAD_PRIORITY_HIGHEST, // 9 NearMaxPriority |
3309 THREAD_PRIORITY_HIGHEST, // 9 NearMaxPriority |
3310 THREAD_PRIORITY_HIGHEST // 10 MaxPriority |
3310 THREAD_PRIORITY_HIGHEST, // 10 MaxPriority |
|
3311 THREAD_PRIORITY_HIGHEST // 11 CriticalPriority |
3311 }; |
3312 }; |
3312 |
3313 |
3313 int prio_policy1[MaxPriority + 1] = { |
3314 int prio_policy1[CriticalPriority + 1] = { |
3314 THREAD_PRIORITY_IDLE, // 0 Entry should never be used |
3315 THREAD_PRIORITY_IDLE, // 0 Entry should never be used |
3315 THREAD_PRIORITY_LOWEST, // 1 MinPriority |
3316 THREAD_PRIORITY_LOWEST, // 1 MinPriority |
3316 THREAD_PRIORITY_LOWEST, // 2 |
3317 THREAD_PRIORITY_LOWEST, // 2 |
3317 THREAD_PRIORITY_BELOW_NORMAL, // 3 |
3318 THREAD_PRIORITY_BELOW_NORMAL, // 3 |
3318 THREAD_PRIORITY_BELOW_NORMAL, // 4 |
3319 THREAD_PRIORITY_BELOW_NORMAL, // 4 |
3319 THREAD_PRIORITY_NORMAL, // 5 NormPriority |
3320 THREAD_PRIORITY_NORMAL, // 5 NormPriority |
3320 THREAD_PRIORITY_ABOVE_NORMAL, // 6 |
3321 THREAD_PRIORITY_ABOVE_NORMAL, // 6 |
3321 THREAD_PRIORITY_ABOVE_NORMAL, // 7 |
3322 THREAD_PRIORITY_ABOVE_NORMAL, // 7 |
3322 THREAD_PRIORITY_HIGHEST, // 8 |
3323 THREAD_PRIORITY_HIGHEST, // 8 |
3323 THREAD_PRIORITY_HIGHEST, // 9 NearMaxPriority |
3324 THREAD_PRIORITY_HIGHEST, // 9 NearMaxPriority |
3324 THREAD_PRIORITY_TIME_CRITICAL // 10 MaxPriority |
3325 THREAD_PRIORITY_TIME_CRITICAL, // 10 MaxPriority |
|
3326 THREAD_PRIORITY_TIME_CRITICAL // 11 CriticalPriority |
3325 }; |
3327 }; |
3326 |
3328 |
3327 static int prio_init() { |
3329 static int prio_init() { |
3328 // If ThreadPriorityPolicy is 1, switch tables |
3330 // If ThreadPriorityPolicy is 1, switch tables |
3329 if (ThreadPriorityPolicy == 1) { |
3331 if (ThreadPriorityPolicy == 1) { |
3330 int i; |
3332 int i; |
3331 for (i = 0; i < MaxPriority + 1; i++) { |
3333 for (i = 0; i < CriticalPriority + 1; i++) { |
3332 os::java_to_os_priority[i] = prio_policy1[i]; |
3334 os::java_to_os_priority[i] = prio_policy1[i]; |
3333 } |
3335 } |
|
3336 } |
|
3337 if (UseCriticalJavaThreadPriority) { |
|
3338 os::java_to_os_priority[MaxPriority] = os::java_to_os_priority[CriticalPriority] ; |
3334 } |
3339 } |
3335 return 0; |
3340 return 0; |
3336 } |
3341 } |
3337 |
3342 |
3338 OSReturn os::set_native_priority(Thread* thread, int priority) { |
3343 OSReturn os::set_native_priority(Thread* thread, int priority) { |