summaryrefslogtreecommitdiffstats
path: root/libart
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-10-22 17:31:12 -0700
committerMathieu Chartier <mathieuc@google.com>2014-10-23 10:11:17 -0700
commit81df4adad0094ee5d4d92d49fdce4e19d3ccea39 (patch)
tree29931fd37c193c6ff9df4466b1a444c863a6fe90 /libart
parent65e04e1efb262a07890b4b99a8c0aa997bea06ca (diff)
downloadlibcore-81df4adad0094ee5d4d92d49fdce4e19d3ccea39.zip
libcore-81df4adad0094ee5d4d92d49fdce4e19d3ccea39.tar.gz
libcore-81df4adad0094ee5d4d92d49fdce4e19d3ccea39.tar.bz2
Only allow once GC request at a time.
There is no reason to allow multiple, allocating threads may have multiple GC requests before the GC starts. Bug: 17942071 (cherry picked from commit 71891f9da2fbcb865931da70ae759032e6698106) Change-Id: I5e2162373bcef1027eb71e5b1699186ff015f92d
Diffstat (limited to 'libart')
-rw-r--r--libart/src/main/java/java/lang/Daemons.java9
1 files changed, 2 insertions, 7 deletions
diff --git a/libart/src/main/java/java/lang/Daemons.java b/libart/src/main/java/java/lang/Daemons.java
index a414c49..4f8285c 100644
--- a/libart/src/main/java/java/lang/Daemons.java
+++ b/libart/src/main/java/java/lang/Daemons.java
@@ -317,11 +317,9 @@ public final class Daemons {
private static class GCDaemon extends Daemon {
private static final GCDaemon INSTANCE = new GCDaemon();
- private int count = 0;
public void requestGC() {
synchronized (this) {
- ++count;
notify();
}
}
@@ -330,11 +328,8 @@ public final class Daemons {
while (isRunning()) {
try {
synchronized (this) {
- // Wait until a request comes in, unless we have a pending request.
- while (count == 0) {
- wait();
- }
- --count;
+ // Wait until a request comes in.
+ wait();
}
VMRuntime.getRuntime().concurrentGC();
} catch (InterruptedException ignored) {