Add and use ScopedSuspendAll
Usage replaces most SuspendAll and ResumeAll calls.
Change-Id: I355683a5365876242cea85a656dcb58455f7a294
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 683b2cf..0607493 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -164,18 +164,16 @@
void Jit::CreateInstrumentationCache(size_t compile_threshold, size_t warmup_threshold) {
CHECK_GT(compile_threshold, 0U);
- Runtime* const runtime = Runtime::Current();
- runtime->GetThreadList()->SuspendAll(__FUNCTION__);
+ ScopedSuspendAll ssa(__FUNCTION__);
// Add Jit interpreter instrumentation, tells the interpreter when to notify the jit to compile
// something.
instrumentation_cache_.reset(
new jit::JitInstrumentationCache(compile_threshold, warmup_threshold));
- runtime->GetInstrumentation()->AddListener(
+ Runtime::Current()->GetInstrumentation()->AddListener(
new jit::JitInstrumentationListener(instrumentation_cache_.get()),
instrumentation::Instrumentation::kMethodEntered |
instrumentation::Instrumentation::kBackwardBranch |
instrumentation::Instrumentation::kInvokeVirtualOrInterface);
- runtime->GetThreadList()->ResumeAll();
}
} // namespace jit