Only allow one thread to abort at a time.
Found when looking to see if Google Earth had fixed their JNI bug yet.
Change-Id: I8768248625869d344ba04ecf4fec06047f76c3ce
diff --git a/src/runtime.cc b/src/runtime.cc
index c70ca77..6a454a0 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -33,6 +33,8 @@
Runtime* Runtime::instance_ = NULL;
+Mutex Runtime::abort_lock_("abort lock");
+
Runtime::Runtime()
: is_zygote_(false),
default_stack_size_(Thread::kDefaultStackSize),
@@ -107,6 +109,10 @@
};
void Runtime::Abort(const char* file, int line) {
+ // Ensure that we don't have multiple threads trying to abort at once,
+ // which would result in significantly worse diagnostics.
+ MutexLock mu(abort_lock_);
+
// Get any pending output out of the way.
fflush(NULL);