OSDN Git Service

dalvik: thread: Set the control group of a thread to the background group
authorSan Mehat <san@google.com>
Fri, 26 Jun 2009 15:36:16 +0000 (08:36 -0700)
committerSan Mehat <san@google.com>
Fri, 26 Jun 2009 18:10:58 +0000 (11:10 -0700)
if the priority is logically-lower than ANDROID_PRIORITY_BACKGROUND

Signed-off-by: San Mehat <san@google.com>
vm/Thread.c
vm/alloc/Heap.c

index acfc7a9..0adde38 100644 (file)
@@ -2819,9 +2819,9 @@ void dvmChangeThreadPriority(Thread* thread, int newPriority)
     }
     newNice = kNiceValues[newPriority-1];
 
-    if (newPriority == ANDROID_PRIORITY_BACKGROUND) {
+    if (newPriority >= ANDROID_PRIORITY_BACKGROUND) {
         dvmChangeThreadSchedulerGroup("bg_non_interactive");
-    } else if (getpriority(PRIO_PROCESS, pid) == ANDROID_PRIORITY_BACKGROUND) {
+    } else if (getpriority(PRIO_PROCESS, pid) >= ANDROID_PRIORITY_BACKGROUND) {
         dvmChangeThreadSchedulerGroup(NULL);
     }
 
index 09954ea..e58a8a8 100644 (file)
@@ -775,7 +775,7 @@ void dvmCollectGarbageInternal(bool collectSoftReferences)
          * in backward UNIX terms means lower priority.
          */
 
-        if (priorityResult == ANDROID_PRIORITY_BACKGROUND) {
+        if (priorityResult >= ANDROID_PRIORITY_BACKGROUND) {
             dvmChangeThreadSchedulerGroup(NULL);
         }
 
@@ -1025,7 +1025,7 @@ void dvmCollectGarbageInternal(bool collectSoftReferences)
             LOGD_HEAP("Reset priority to %d\n", oldThreadPriority);
         }
 
-        if (oldThreadPriority == ANDROID_PRIORITY_BACKGROUND) {
+        if (oldThreadPriority >= ANDROID_PRIORITY_BACKGROUND) {
             dvmChangeThreadSchedulerGroup("bg_non_interactive");
         }
     }