Add and use ScopedSuspendAll
Usage replaces most SuspendAll and ResumeAll calls.
Change-Id: I355683a5365876242cea85a656dcb58455f7a294
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 9f05e64..4c1408a 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -1140,23 +1140,20 @@
if (IsImage()) {
TimingLogger::ScopedTiming t("UpdateImageClasses", timings);
- Runtime* current = Runtime::Current();
+ Runtime* runtime = Runtime::Current();
// Suspend all threads.
- current->GetThreadList()->SuspendAll(__FUNCTION__);
+ ScopedSuspendAll ssa(__FUNCTION__);
std::string error_msg;
std::unique_ptr<ClinitImageUpdate> update(ClinitImageUpdate::Create(image_classes_.get(),
Thread::Current(),
- current->GetClassLinker(),
+ runtime->GetClassLinker(),
&error_msg));
CHECK(update.get() != nullptr) << error_msg; // TODO: Soft failure?
// Do the marking.
update->Walk();
-
- // Resume threads.
- current->GetThreadList()->ResumeAll();
}
}