17ec681f3Smrg/* 27ec681f3Smrg * Copyright (C) 2013 The Android Open Source Project 37ec681f3Smrg * 47ec681f3Smrg * Licensed under the Apache License, Version 2.0 (the "License"); 57ec681f3Smrg * you may not use this file except in compliance with the License. 67ec681f3Smrg * You may obtain a copy of the License at 77ec681f3Smrg * 87ec681f3Smrg * http://www.apache.org/licenses/LICENSE-2.0 97ec681f3Smrg * 107ec681f3Smrg * Unless required by applicable law or agreed to in writing, software 117ec681f3Smrg * distributed under the License is distributed on an "AS IS" BASIS, 127ec681f3Smrg * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 137ec681f3Smrg * See the License for the specific language governing permissions and 147ec681f3Smrg * limitations under the License. 157ec681f3Smrg */ 167ec681f3Smrg 177ec681f3Smrg#ifndef ANDROID_THREAD_DEFS_H 187ec681f3Smrg#define ANDROID_THREAD_DEFS_H 197ec681f3Smrg 207ec681f3Smrg#include "graphics.h" 217ec681f3Smrg 227ec681f3Smrg#if defined(__cplusplus) 237ec681f3Smrgextern "C" { 247ec681f3Smrg#endif 257ec681f3Smrg 267ec681f3Smrgenum { 277ec681f3Smrg /* 287ec681f3Smrg * *********************************************** 297ec681f3Smrg * ** Keep in sync with android.os.Process.java ** 307ec681f3Smrg * *********************************************** 317ec681f3Smrg * 327ec681f3Smrg * This maps directly to the "nice" priorities we use in Android. 337ec681f3Smrg * A thread priority should be chosen inverse-proportionally to 347ec681f3Smrg * the amount of work the thread is expected to do. The more work 357ec681f3Smrg * a thread will do, the less favorable priority it should get so that 367ec681f3Smrg * it doesn't starve the system. Threads not behaving properly might 377ec681f3Smrg * be "punished" by the kernel. 387ec681f3Smrg * Use the levels below when appropriate. Intermediate values are 397ec681f3Smrg * acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below. 407ec681f3Smrg */ 417ec681f3Smrg ANDROID_PRIORITY_LOWEST = 19, 427ec681f3Smrg 437ec681f3Smrg /* use for background tasks */ 447ec681f3Smrg ANDROID_PRIORITY_BACKGROUND = 10, 457ec681f3Smrg 467ec681f3Smrg /* most threads run at normal priority */ 477ec681f3Smrg ANDROID_PRIORITY_NORMAL = 0, 487ec681f3Smrg 497ec681f3Smrg /* threads currently running a UI that the user is interacting with */ 507ec681f3Smrg ANDROID_PRIORITY_FOREGROUND = -2, 517ec681f3Smrg 527ec681f3Smrg /* the main UI thread has a slightly more favorable priority */ 537ec681f3Smrg ANDROID_PRIORITY_DISPLAY = -4, 547ec681f3Smrg 557ec681f3Smrg /* ui service treads might want to run at a urgent display (uncommon) */ 567ec681f3Smrg ANDROID_PRIORITY_URGENT_DISPLAY = HAL_PRIORITY_URGENT_DISPLAY, 577ec681f3Smrg 587ec681f3Smrg /* all normal video threads */ 597ec681f3Smrg ANDROID_PRIORITY_VIDEO = -10, 607ec681f3Smrg 617ec681f3Smrg /* all normal audio threads */ 627ec681f3Smrg ANDROID_PRIORITY_AUDIO = -16, 637ec681f3Smrg 647ec681f3Smrg /* service audio threads (uncommon) */ 657ec681f3Smrg ANDROID_PRIORITY_URGENT_AUDIO = -19, 667ec681f3Smrg 677ec681f3Smrg /* should never be used in practice. regular process might not 687ec681f3Smrg * be allowed to use this level */ 697ec681f3Smrg ANDROID_PRIORITY_HIGHEST = -20, 707ec681f3Smrg 717ec681f3Smrg ANDROID_PRIORITY_DEFAULT = ANDROID_PRIORITY_NORMAL, 727ec681f3Smrg ANDROID_PRIORITY_MORE_FAVORABLE = -1, 737ec681f3Smrg ANDROID_PRIORITY_LESS_FAVORABLE = +1, 747ec681f3Smrg}; 757ec681f3Smrg 767ec681f3Smrg#if defined(__cplusplus) 777ec681f3Smrg} 787ec681f3Smrg#endif 797ec681f3Smrg 807ec681f3Smrg#endif /* ANDROID_THREAD_DEFS_H */ 81