summaryrefslogtreecommitdiffstats
path: root/include/utils/threads.h
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-12-07 17:59:37 -0800
committerDianne Hackborn <hackbod@google.com>2009-12-07 19:11:14 -0800
commit8c6cedc9bc9a4b69616a79a95449f6f6b08c7bf1 (patch)
treeb1bbc3748af558bc7a56d7ac4fb96ca059cc845b /include/utils/threads.h
parentd56352bddd717d2e45f1f3ee7fb52ef7f593f950 (diff)
downloadframeworks_native-8c6cedc9bc9a4b69616a79a95449f6f6b08c7bf1.zip
frameworks_native-8c6cedc9bc9a4b69616a79a95449f6f6b08c7bf1.tar.gz
frameworks_native-8c6cedc9bc9a4b69616a79a95449f6f6b08c7bf1.tar.bz2
Propagate background scheduling class across processes.
This is a very simply implementation: upon receiving an IPC, if the handling thread is at a background priority (the driver will have taken care of propagating this from the calling thread), then stick it in to the background scheduling group. Plus an API to turn this off for the process, which is used by the system process. This also pulls some of the code for managing scheduling classes out of the Process JNI wrappers and in to some convenience methods in thread.h.
Diffstat (limited to 'include/utils/threads.h')
-rw-r--r--include/utils/threads.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/utils/threads.h b/include/utils/threads.h
index 0fc533f..130d83c 100644
--- a/include/utils/threads.h
+++ b/include/utils/threads.h
@@ -124,6 +124,24 @@ typedef int (*android_create_thread_fn)(android_thread_func_t entryFunction,
extern void androidSetCreateThreadFunc(android_create_thread_fn func);
+// ------------------------------------------------------------------
+// Extra functions working with raw pids.
+
+// Get pid for the current thread.
+extern pid_t androidGetTid();
+
+// Change the scheduling group of a particular thread. The group
+// should be one of the ANDROID_TGROUP constants. Returns BAD_VALUE if
+// grp is out of range, else another non-zero value with errno set if
+// the operation failed.
+extern int androidSetThreadSchedulingGroup(pid_t tid, int grp);
+
+// Change the priority AND scheduling group of a particular thread. The priority
+// should be one of the ANDROID_PRIORITY constants. Returns INVALID_OPERATION
+// if the priority set failed, else another value if just the group set failed;
+// in either case errno is set.
+extern int androidSetThreadPriority(pid_t tid, int prio);
+
#ifdef __cplusplus
}
#endif