Change state to waiting during aborting the VM

Symptom:
Process freeze when multiple runtime error happen on runnable threads.

Root cause:
When multiple runtime error happen, only one thread locks abort_lock_
and other threads are blocked even if they are runnable state.
If an other thread tries to suspend blocked threads at the same time,
blocked threads can't be suspended until abort_lock_ is unlocked from
owner thread. But owner thread can be suspended even if it locks
abort_lock_. Thus, these threads causes dead lock.

Solution:
Change state to waiting when locking abort_lock_.

Bug: 127875380
Change-Id: I7e914924690bb30d6d0490cf5f8afdb1c3cd4e4a
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index d698d48..4565939 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -584,9 +584,12 @@
 #endif
   }
 
-  // Ensure that we don't have multiple threads trying to abort at once,
-  // which would result in significantly worse diagnostics.
-  MutexLock mu(Thread::Current(), *Locks::abort_lock_);
+  {
+    // Ensure that we don't have multiple threads trying to abort at once,
+    // which would result in significantly worse diagnostics.
+    ScopedThreadStateChange tsc(Thread::Current(), kNativeForAbort);
+    Locks::abort_lock_->ExclusiveLock(Thread::Current());
+  }
 
   // Get any pending output out of the way.
   fflush(nullptr);