summaryrefslogtreecommitdiff
path: root/runtime/gc/reference_queue.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2014-09-12 12:58:05 -0700
committer Mathieu Chartier <mathieuc@google.com> 2014-09-14 14:48:24 -0700
commita5a53efea976af505f4f849b5925d5e14c4f8e5c (patch)
tree455a536a9394908c17ec1ede04ab7ec49f9d3420 /runtime/gc/reference_queue.cc
parent91bbd5347b391278b56440b2dbb0b77526bae4e8 (diff)
Add native support for FinalizerList.makeCircularListIfUnenqueued
Called from FinalizerReference.enqueueSentinelReference to prevent a race where the GC updates pendingNext of the sentinel reference before enqueueSentinelReference. Bug: 17462553 (cherry picked from commit 3256166df40981f1f1997a5f00303712277c963f) Change-Id: I7ad2fd250c2715d1aeb919bd548ef9aab24f30a2
Diffstat (limited to 'runtime/gc/reference_queue.cc')
-rw-r--r--runtime/gc/reference_queue.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/runtime/gc/reference_queue.cc b/runtime/gc/reference_queue.cc
index c3931e8bdc..4003524e5e 100644
--- a/runtime/gc/reference_queue.cc
+++ b/runtime/gc/reference_queue.cc
@@ -25,13 +25,12 @@
namespace art {
namespace gc {
-ReferenceQueue::ReferenceQueue()
- : lock_("reference queue lock"), list_(nullptr) {
+ReferenceQueue::ReferenceQueue(Mutex* lock) : lock_(lock), list_(nullptr) {
}
void ReferenceQueue::AtomicEnqueueIfNotEnqueued(Thread* self, mirror::Reference* ref) {
DCHECK(ref != NULL);
- MutexLock mu(self, lock_);
+ MutexLock mu(self, *lock_);
if (!ref->IsEnqueued()) {
EnqueuePendingReference(ref);
}