| 1 | /* |
| 2 | * Copyright (C) 2013 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_THREAD_DEFS_H |
| 18 | #define ANDROID_THREAD_DEFS_H |
| 19 | |
| 20 | /* FREDRIK */ |
| 21 | /* #include "graphics.h" */ |
| 22 | |
| 23 | #if defined(__cplusplus) |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | enum { |
| 28 | /* |
| 29 | * *********************************************** |
| 30 | * ** Keep in sync with android.os.Process.java ** |
| 31 | * *********************************************** |
| 32 | * |
| 33 | * This maps directly to the "nice" priorities we use in Android. |
| 34 | * A thread priority should be chosen inverse-proportionally to |
| 35 | * the amount of work the thread is expected to do. The more work |
| 36 | * a thread will do, the less favorable priority it should get so that |
| 37 | * it doesn't starve the system. Threads not behaving properly might |
| 38 | * be "punished" by the kernel. |
| 39 | * Use the levels below when appropriate. Intermediate values are |
| 40 | * acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below. |
| 41 | */ |
| 42 | ANDROID_PRIORITY_LOWEST = 19, |
| 43 | |
| 44 | /* use for background tasks */ |
| 45 | ANDROID_PRIORITY_BACKGROUND = 10, |
| 46 | |
| 47 | /* most threads run at normal priority */ |
| 48 | ANDROID_PRIORITY_NORMAL = 0, |
| 49 | |
| 50 | /* threads currently running a UI that the user is interacting with */ |
| 51 | ANDROID_PRIORITY_FOREGROUND = -2, |
| 52 | |
| 53 | /* the main UI thread has a slightly more favorable priority */ |
| 54 | ANDROID_PRIORITY_DISPLAY = -4, |
| 55 | |
| 56 | /* ui service treads might want to run at a urgent display (uncommon) */ |
| 57 | ANDROID_PRIORITY_URGENT_DISPLAY = ANDROID_PRIORITY_DISPLAY /* FREDRIK */, |
| 58 | |
| 59 | /* all normal audio threads */ |
| 60 | ANDROID_PRIORITY_AUDIO = -16, |
| 61 | |
| 62 | /* service audio threads (uncommon) */ |
| 63 | ANDROID_PRIORITY_URGENT_AUDIO = -19, |
| 64 | |
| 65 | /* should never be used in practice. regular process might not |
| 66 | * be allowed to use this level */ |
| 67 | ANDROID_PRIORITY_HIGHEST = -20, |
| 68 | |
| 69 | ANDROID_PRIORITY_DEFAULT = ANDROID_PRIORITY_NORMAL, |
| 70 | ANDROID_PRIORITY_MORE_FAVORABLE = -1, |
| 71 | ANDROID_PRIORITY_LESS_FAVORABLE = +1, |
| 72 | }; |
| 73 | |
| 74 | #if defined(__cplusplus) |
| 75 | } |
| 76 | #endif |
| 77 | |
| 78 | #endif /* ANDROID_THREAD_DEFS_H */ |