Mercurial > hg > truffle
comparison src/share/vm/runtime/os.cpp @ 6766:a7509aff1b06
7194254: jstack reports wrong thread priorities
Reviewed-by: dholmes, sla, fparain
Contributed-by: Dmytro Sheyko <dmytro_sheyko@hotmail.com>
author | dholmes |
---|---|
date | Mon, 17 Sep 2012 07:36:31 -0400 |
parents | da91efe96a93 |
children | 85f1cded9793 |
comparison
equal
deleted
inserted
replaced
6749:a6fe94b9759f | 6766:a7509aff1b06 |
---|---|
199 assert(false, "Should not happen"); | 199 assert(false, "Should not happen"); |
200 return OS_ERR; | 200 return OS_ERR; |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 | 204 // The mapping from OS priority back to Java priority may be inexact because |
205 // Java priorities can map M:1 with native priorities. If you want the definite | |
206 // Java priority then use JavaThread::java_priority() | |
205 OSReturn os::get_priority(const Thread* const thread, ThreadPriority& priority) { | 207 OSReturn os::get_priority(const Thread* const thread, ThreadPriority& priority) { |
206 int p; | 208 int p; |
207 int os_prio; | 209 int os_prio; |
208 OSReturn ret = get_native_priority(thread, &os_prio); | 210 OSReturn ret = get_native_priority(thread, &os_prio); |
209 if (ret != OS_OK) return ret; | 211 if (ret != OS_OK) return ret; |
210 | 212 |
211 for (p = MaxPriority; p > MinPriority && java_to_os_priority[p] > os_prio; p--) ; | 213 if (java_to_os_priority[MaxPriority] > java_to_os_priority[MinPriority]) { |
214 for (p = MaxPriority; p > MinPriority && java_to_os_priority[p] > os_prio; p--) ; | |
215 } else { | |
216 // niceness values are in reverse order | |
217 for (p = MaxPriority; p > MinPriority && java_to_os_priority[p] < os_prio; p--) ; | |
218 } | |
212 priority = (ThreadPriority)p; | 219 priority = (ThreadPriority)p; |
213 return OS_OK; | 220 return OS_OK; |
214 } | 221 } |
215 | 222 |
216 | 223 |