Run checkpoints after resuming threads in signal catcher SIGQUIT.

Previously we were running checkpoints after restoring the thread
state, but before resuming the threads. This caused an issue with
profiler checkpoints since these use a ScopedObjectAccess. Since
we had with exclusive access to the mutator lock when we ran the
checkpoints, it caused deadlocks when we tried to gain shared
access to the mutator lock in the ScopedThreadStateChange if the
old_state was any state other than kRunnable.

Bug: 12490061
Change-Id: I5f922693a4bf5d18cf9d22f1f28a7a04b6bfc077
diff --git a/runtime/signal_catcher.cc b/runtime/signal_catcher.cc
index fe62e25..611c0a8 100644
--- a/runtime/signal_catcher.cc
+++ b/runtime/signal_catcher.cc
@@ -145,12 +145,13 @@
   }
   os << "----- end " << getpid() << " -----\n";
   CHECK_EQ(self->SetStateUnsafe(old_state), kRunnable);
+  self->EndAssertNoThreadSuspension(old_cause);
+  thread_list->ResumeAll();
+  // Run the checkpoints after resuming the threads to prevent deadlocks if the checkpoint function
+  // acquires the mutator lock.
   if (self->ReadFlag(kCheckpointRequest)) {
     self->RunCheckpointFunction();
   }
-  self->EndAssertNoThreadSuspension(old_cause);
-  thread_list->ResumeAll();
-
   Output(os.str());
 }