summaryrefslogtreecommitdiffstats
path: root/include/cutils
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2009-09-12 10:06:57 -0700
committerSan Mehat <san@google.com>2009-09-12 10:48:03 -0700
commit493dad966305a7fb555addd367532dd2af275a27 (patch)
treec3433e8485914a7a9263536ddd5e6c5486ff8038 /include/cutils
parent25f1a5aaffd1ef6e87d53d4fd3c14ea1b6c5b940 (diff)
downloadsystem_core-493dad966305a7fb555addd367532dd2af275a27.zip
system_core-493dad966305a7fb555addd367532dd2af275a27.tar.gz
system_core-493dad966305a7fb555addd367532dd2af275a27.tar.bz2
libcutils: Add abstracted support for setting scheduler policies
Also changes the background policy to use SCHED_BATCH. IDLEPRIO can cause 100% starvation. Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'include/cutils')
-rw-r--r--include/cutils/sched_policy.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/cutils/sched_policy.h b/include/cutils/sched_policy.h
new file mode 100644
index 0000000..efa7cbc
--- /dev/null
+++ b/include/cutils/sched_policy.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CUTILS_SCHED_POLICY_H
+#define __CUTILS_SCHED_POLICY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ SP_BACKGROUND = 0,
+ SP_FOREGROUND = 1,
+} SchedPolicy;
+
+extern int set_sched_policy(int tid, SchedPolicy policy);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CUTILS_SCHED_POLICY_H */