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
21 /* #include "graphics.h" */
23 #if defined(__cplusplus)
29 * ***********************************************
30 * ** Keep in sync with android.os.Process.java **
31 * ***********************************************
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.
42 ANDROID_PRIORITY_LOWEST = 19,
44 /* use for background tasks */
45 ANDROID_PRIORITY_BACKGROUND = 10,
47 /* most threads run at normal priority */
48 ANDROID_PRIORITY_NORMAL = 0,
50 /* threads currently running a UI that the user is interacting with */
51 ANDROID_PRIORITY_FOREGROUND = -2,
53 /* the main UI thread has a slightly more favorable priority */
54 ANDROID_PRIORITY_DISPLAY = -4,
56 /* ui service treads might want to run at a urgent display (uncommon) */
57 ANDROID_PRIORITY_URGENT_DISPLAY = ANDROID_PRIORITY_DISPLAY /* FREDRIK */,
59 /* all normal audio threads */
60 ANDROID_PRIORITY_AUDIO = -16,
62 /* service audio threads (uncommon) */
63 ANDROID_PRIORITY_URGENT_AUDIO = -19,
65 /* should never be used in practice. regular process might not
66 * be allowed to use this level */
67 ANDROID_PRIORITY_HIGHEST = -20,
69 ANDROID_PRIORITY_DEFAULT = ANDROID_PRIORITY_NORMAL,
70 ANDROID_PRIORITY_MORE_FAVORABLE = -1,
71 ANDROID_PRIORITY_LESS_FAVORABLE = +1,
74 #if defined(__cplusplus)
78 #endif /* ANDROID_THREAD_DEFS_H */