2 * Copyright (C) 2013 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ANDROID_THREAD_DEFS_H
18 #define ANDROID_THREAD_DEFS_H
22 #if defined(__cplusplus)
28 * ***********************************************
29 * ** Keep in sync with android.os.Process.java **
30 * ***********************************************
32 * This maps directly to the "nice" priorities we use in Android.
33 * A thread priority should be chosen inverse-proportionally to
34 * the amount of work the thread is expected to do. The more work
35 * a thread will do, the less favorable priority it should get so that
36 * it doesn't starve the system. Threads not behaving properly might
37 * be "punished" by the kernel.
38 * Use the levels below when appropriate. Intermediate values are
39 * acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below.
41 ANDROID_PRIORITY_LOWEST
= 19,
43 /* use for background tasks */
44 ANDROID_PRIORITY_BACKGROUND
= 10,
46 /* most threads run at normal priority */
47 ANDROID_PRIORITY_NORMAL
= 0,
49 /* threads currently running a UI that the user is interacting with */
50 ANDROID_PRIORITY_FOREGROUND
= -2,
52 /* the main UI thread has a slightly more favorable priority */
53 ANDROID_PRIORITY_DISPLAY
= -4,
55 /* ui service treads might want to run at a urgent display (uncommon) */
56 ANDROID_PRIORITY_URGENT_DISPLAY
= HAL_PRIORITY_URGENT_DISPLAY
,
58 /* all normal video threads */
59 ANDROID_PRIORITY_VIDEO
= -10,
61 /* all normal audio threads */
62 ANDROID_PRIORITY_AUDIO
= -16,
64 /* service audio threads (uncommon) */
65 ANDROID_PRIORITY_URGENT_AUDIO
= -19,
67 /* should never be used in practice. regular process might not
68 * be allowed to use this level */
69 ANDROID_PRIORITY_HIGHEST
= -20,
71 ANDROID_PRIORITY_DEFAULT
= ANDROID_PRIORITY_NORMAL
,
72 ANDROID_PRIORITY_MORE_FAVORABLE
= -1,
73 ANDROID_PRIORITY_LESS_FAVORABLE
= +1,
76 #if defined(__cplusplus)
80 #endif /* ANDROID_THREAD_DEFS_H */