1 /* 2 * Copyright (C) 2011 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 struct Thread; 18 19 /* 20 * Raises the scheduling priority of the current thread. Returns the 21 * original priority if successful, or INT_MAX on failure. 22 * Use os_lowerThreadPriority to undo. 23 * 24 * TODO: does the GC really need this? 25 */ 26 int os_raiseThreadPriority(); 27 28 /* 29 * Sets the current thread scheduling priority. Used to undo the effects 30 * of an earlier call to os_raiseThreadPriority. 31 * 32 * TODO: does the GC really need this? 33 */ 34 void os_lowerThreadPriority(int oldThreadPriority); 35 36 /* 37 * Changes the priority of a system thread to match that of the Thread object. 38 * 39 * We map a priority value from 1-10 to Linux "nice" values, where lower 40 * numbers indicate higher priority. 41 */ 42 void os_changeThreadPriority(Thread* thread, int newPriority); 43 44 /* 45 * Returns the thread priority for the current thread by querying the system. 46 * This is useful when attaching a thread through JNI. 47 * 48 * Returns a value from 1 to 10 (compatible with java.lang.Thread values). 49 */ 50 int os_getThreadPriorityFromSystem(); 51