1 /* |
1 /* |
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
3587 // threads. It has always been the case, but could change in the future. For |
3587 // threads. It has always been the case, but could change in the future. For |
3588 // this reason, the code should not be used as default (ThreadPriorityPolicy=0). |
3588 // this reason, the code should not be used as default (ThreadPriorityPolicy=0). |
3589 // It is only used when ThreadPriorityPolicy=1 and requires root privilege. |
3589 // It is only used when ThreadPriorityPolicy=1 and requires root privilege. |
3590 |
3590 |
3591 #if defined(_ALLBSD_SOURCE) && !defined(__APPLE__) |
3591 #if defined(_ALLBSD_SOURCE) && !defined(__APPLE__) |
3592 int os::java_to_os_priority[MaxPriority + 1] = { |
3592 int os::java_to_os_priority[CriticalPriority + 1] = { |
3593 19, // 0 Entry should never be used |
3593 19, // 0 Entry should never be used |
3594 |
3594 |
3595 0, // 1 MinPriority |
3595 0, // 1 MinPriority |
3596 3, // 2 |
3596 3, // 2 |
3597 6, // 3 |
3597 6, // 3 |
3598 |
3598 |
3599 10, // 4 |
3599 10, // 4 |
3600 15, // 5 NormPriority |
3600 15, // 5 NormPriority |
3601 18, // 6 |
3601 18, // 6 |
3602 |
3602 |
3603 21, // 7 |
3603 21, // 7 |
3604 25, // 8 |
3604 25, // 8 |
3605 28, // 9 NearMaxPriority |
3605 28, // 9 NearMaxPriority |
3606 |
3606 |
3607 31 // 10 MaxPriority |
3607 31, // 10 MaxPriority |
|
3608 |
|
3609 31 // 11 CriticalPriority |
3608 }; |
3610 }; |
3609 #elif defined(__APPLE__) |
3611 #elif defined(__APPLE__) |
3610 /* Using Mach high-level priority assignments */ |
3612 /* Using Mach high-level priority assignments */ |
3611 int os::java_to_os_priority[MaxPriority + 1] = { |
3613 int os::java_to_os_priority[CriticalPriority + 1] = { |
3612 0, // 0 Entry should never be used (MINPRI_USER) |
3614 0, // 0 Entry should never be used (MINPRI_USER) |
3613 |
3615 |
3614 27, // 1 MinPriority |
3616 27, // 1 MinPriority |
3615 28, // 2 |
3617 28, // 2 |
3616 29, // 3 |
3618 29, // 3 |
3621 |
3623 |
3622 33, // 7 |
3624 33, // 7 |
3623 34, // 8 |
3625 34, // 8 |
3624 35, // 9 NearMaxPriority |
3626 35, // 9 NearMaxPriority |
3625 |
3627 |
3626 36 // 10 MaxPriority |
3628 36, // 10 MaxPriority |
|
3629 |
|
3630 36 // 11 CriticalPriority |
3627 }; |
3631 }; |
3628 #else |
3632 #else |
3629 int os::java_to_os_priority[MaxPriority + 1] = { |
3633 int os::java_to_os_priority[CriticalPriority + 1] = { |
3630 19, // 0 Entry should never be used |
3634 19, // 0 Entry should never be used |
3631 |
3635 |
3632 4, // 1 MinPriority |
3636 4, // 1 MinPriority |
3633 3, // 2 |
3637 3, // 2 |
3634 2, // 3 |
3638 2, // 3 |
3654 if (!FLAG_IS_DEFAULT(ThreadPriorityPolicy)) { |
3660 if (!FLAG_IS_DEFAULT(ThreadPriorityPolicy)) { |
3655 warning("-XX:ThreadPriorityPolicy requires root privilege on Bsd"); |
3661 warning("-XX:ThreadPriorityPolicy requires root privilege on Bsd"); |
3656 } |
3662 } |
3657 ThreadPriorityPolicy = 0; |
3663 ThreadPriorityPolicy = 0; |
3658 } |
3664 } |
|
3665 } |
|
3666 if (UseCriticalJavaThreadPriority) { |
|
3667 os::java_to_os_priority[MaxPriority] = os::java_to_os_priority[CriticalPriority]; |
3659 } |
3668 } |
3660 return 0; |
3669 return 0; |
3661 } |
3670 } |
3662 |
3671 |
3663 OSReturn os::set_native_priority(Thread* thread, int newpri) { |
3672 OSReturn os::set_native_priority(Thread* thread, int newpri) { |