OSDN Git Service

Avoid some recursive aborting.
authorIan Rogers <irogers@google.com>
Sat, 22 Nov 2014 06:52:16 +0000 (22:52 -0800)
committerIan Rogers <irogers@google.com>
Sat, 22 Nov 2014 06:57:44 +0000 (22:57 -0800)
Bug: 18469797
Change-Id: Ic1889a605a041bdec679ff54f8dce3842d85f2e1

runtime/base/mutex-inl.h

index c310191..cb69817 100644 (file)
@@ -97,7 +97,9 @@ inline void BaseMutex::RegisterAsLocked(Thread* self) {
         }
       }
     }
-    CHECK(!bad_mutexes_held);
+    if (gAborting == 0) {  // Avoid recursive aborts.
+      CHECK(!bad_mutexes_held);
+    }
   }
   // Don't record monitors as they are outside the scope of analysis. They may be inspected off of
   // the monitor list.
@@ -112,7 +114,7 @@ inline void BaseMutex::RegisterAsUnlocked(Thread* self) {
     return;
   }
   if (level_ != kMonitorLock) {
-    if (kDebugLocking && !gAborting) {
+    if (kDebugLocking && gAborting == 0) {  // Avoid recursive aborts.
       CHECK(self->GetHeldMutex(level_) == this) << "Unlocking on unacquired mutex: " << name_;
     }
     self->SetHeldMutex(level_, NULL);