diff options
Diffstat (limited to 'libart')
-rw-r--r-- | libart/src/main/java/java/lang/Daemons.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libart/src/main/java/java/lang/Daemons.java b/libart/src/main/java/java/lang/Daemons.java index 4f8285c..726f782 100644 --- a/libart/src/main/java/java/lang/Daemons.java +++ b/libart/src/main/java/java/lang/Daemons.java @@ -20,6 +20,7 @@ import dalvik.system.VMRuntime; import java.lang.ref.FinalizerReference; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.TimeoutException; import libcore.util.EmptyArray; @@ -317,11 +318,16 @@ public final class Daemons { private static class GCDaemon extends Daemon { private static final GCDaemon INSTANCE = new GCDaemon(); + private static final AtomicBoolean atomicBoolean = new AtomicBoolean(); public void requestGC() { + if (atomicBoolean.getAndSet(true)) { + return; + } synchronized (this) { notify(); } + atomicBoolean.set(false); } @Override public void run() { |