summaryrefslogtreecommitdiffstats
path: root/libs/utils
diff options
context:
space:
mode:
Diffstat (limited to 'libs/utils')
-rw-r--r--libs/utils/Android.mk25
-rw-r--r--libs/utils/Threads.cpp45
2 files changed, 28 insertions, 42 deletions
diff --git a/libs/utils/Android.mk b/libs/utils/Android.mk
index cbfe7bd..ce25605 100644
--- a/libs/utils/Android.mk
+++ b/libs/utils/Android.mk
@@ -98,7 +98,7 @@ LOCAL_LDLIBS += $(host_commonLdlibs)
include $(BUILD_HOST_STATIC_LIBRARY)
-# For the device
+# For the device, static
# =====================================================
include $(CLEAR_VARS)
@@ -123,14 +123,29 @@ LOCAL_C_INCLUDES += \
LOCAL_LDLIBS += -lpthread
-LOCAL_SHARED_LIBRARIES := \
- liblog \
+LOCAL_STATIC_LIBRARIES := \
libcutils \
- libdl \
- libcorkscrew \
libz
+LOCAL_SHARED_LIBRARIES := \
+ libcorkscrew \
+ liblog \
+ libdl
+
+LOCAL_MODULE:= libutils
+include $(BUILD_STATIC_LIBRARY)
+
+# For the device, shared
+# =====================================================
+include $(CLEAR_VARS)
LOCAL_MODULE:= libutils
+LOCAL_WHOLE_STATIC_LIBRARIES := libutils
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libcutils \
+ libdl \
+ libcorkscrew \
+ libz
include $(BUILD_SHARED_LIBRARY)
# Include subdirectory makefiles
diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp
index 7b877e0..e0f12dc 100644
--- a/libs/utils/Threads.cpp
+++ b/libs/utils/Threads.cpp
@@ -68,20 +68,6 @@ using namespace android;
typedef void* (*android_pthread_entry)(void*);
-static pthread_once_t gDoSchedulingGroupOnce = PTHREAD_ONCE_INIT;
-static bool gDoSchedulingGroup = true;
-
-static void checkDoSchedulingGroup(void) {
- char buf[PROPERTY_VALUE_MAX];
- int len = property_get("debug.sys.noschedgroups", buf, "");
- if (len > 0) {
- int temp;
- if (sscanf(buf, "%d", &temp) == 1) {
- gDoSchedulingGroup = temp == 0;
- }
- }
-}
-
struct thread_data_t {
thread_func_t entryFunction;
void* userData;
@@ -97,15 +83,10 @@ struct thread_data_t {
char * name = t->threadName;
delete t;
setpriority(PRIO_PROCESS, 0, prio);
- pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup);
- if (gDoSchedulingGroup) {
- if (prio >= ANDROID_PRIORITY_BACKGROUND) {
- set_sched_policy(androidGetTid(), SP_BACKGROUND);
- } else if (prio > ANDROID_PRIORITY_AUDIO) {
- set_sched_policy(androidGetTid(), SP_FOREGROUND);
- } else {
- // defaults to that of parent, or as set by requestPriority()
- }
+ if (prio >= ANDROID_PRIORITY_BACKGROUND) {
+ set_sched_policy(0, SP_BACKGROUND);
+ } else {
+ set_sched_policy(0, SP_FOREGROUND);
}
if (name) {
@@ -337,20 +318,10 @@ int androidSetThreadPriority(pid_t tid, int pri)
#if defined(HAVE_PTHREADS)
int lasterr = 0;
- pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup);
- if (gDoSchedulingGroup) {
- // set_sched_policy does not support tid == 0
- int policy_tid;
- if (tid == 0) {
- policy_tid = androidGetTid();
- } else {
- policy_tid = tid;
- }
- if (pri >= ANDROID_PRIORITY_BACKGROUND) {
- rc = set_sched_policy(policy_tid, SP_BACKGROUND);
- } else if (getpriority(PRIO_PROCESS, tid) >= ANDROID_PRIORITY_BACKGROUND) {
- rc = set_sched_policy(policy_tid, SP_FOREGROUND);
- }
+ if (pri >= ANDROID_PRIORITY_BACKGROUND) {
+ rc = set_sched_policy(tid, SP_BACKGROUND);
+ } else if (getpriority(PRIO_PROCESS, tid) >= ANDROID_PRIORITY_BACKGROUND) {
+ rc = set_sched_policy(tid, SP_FOREGROUND);
}
if (rc) {