Fix thread initialization issue when runtime started twice (as seen in image_test)
Change-Id: Ic20758ee64c1b2c41cd2329cf6d66b15d0ac2473
diff --git a/runtime/thread.cc b/runtime/thread.cc
index d6bd8a4..0020d52 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -921,7 +921,13 @@
CHECK(!is_started_);
is_started_ = true;
{
- MutexLock mu(Thread::Current(), *Locks::thread_suspend_count_lock_); // Keep GCC happy.
+ // MutexLock to keep annotalysis happy.
+ //
+ // Note we use NULL for the thread because Thread::Current can
+ // return garbage since (is_started_ == true) and
+ // Thread::pthread_key_self_ is not yet initialized.
+ // This was seen on glibc.
+ MutexLock mu(NULL, *Locks::thread_suspend_count_lock_);
resume_cond_ = new ConditionVariable("Thread resumption condition variable",
*Locks::thread_suspend_count_lock_);
}