Lock thread list, show join target
There were some paths to "thread list lock must be held" functions that
weren't locking the thread list. We now do trylock/unlock in dumpFrames
to ensure that doesn't happen.
Also, append "tid=N" to the "waiting on" line in stack trace output
when we're waiting on a VMThread object (i.e. we're in Thread.join()).
Bug 2827015 (for the thread list lock).
Change-Id: I05aa27dd440c671b22ef7cfe47e31dfe54b0ed2d
diff --git a/vm/Thread.c b/vm/Thread.c
index a932889..a98dbd0 100644
--- a/vm/Thread.c
+++ b/vm/Thread.c
@@ -504,6 +504,17 @@
}
/*
+ * Try to lock the thread list.
+ *
+ * Returns "true" if we locked it. This is a "fast" mutex, so if the
+ * current thread holds the lock this will fail.
+ */
+bool dvmTryLockThreadList(void)
+{
+ return (dvmTryLockMutex(&gDvm.threadListLock) == 0);
+}
+
+/*
* Release the thread list global lock.
*/
void dvmUnlockThreadList(void)