summaryrefslogtreecommitdiffstats
path: root/vm/Thread.h
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2010-03-12 13:39:59 -0800
committerAndy McFadden <fadden@android.com>2010-03-15 07:23:00 -0700
commitfd54266907c3046339b48748f63afa32ee3ab4e1 (patch)
treecf4fc20f5caa30a64841e4593778cfd7e2998801 /vm/Thread.h
parent50309bfe4693c39d2ef3bc1e6e87bdd311aec2d9 (diff)
downloadandroid_dalvik-fd54266907c3046339b48748f63afa32ee3ab4e1.tar.gz
android_dalvik-fd54266907c3046339b48748f63afa32ee3ab4e1.tar.bz2
android_dalvik-fd54266907c3046339b48748f63afa32ee3ab4e1.zip
Try to show lock owner in MONITOR thread dump.
A thread in the MONITOR state is blocked waiting on a monitor. This raises two interesting questions: (1) what lock is it waiting on, and (2) who holds that lock? The answer to (1) can be determined easily by looking at the source code, but (2) is a bit harder. This change extracts the target object from the instruction stream and prints some information about it, e.g.: - waiting to lock <0x40028c68> (a java.lang.Object) held by threadid=1 (main) Change-Id: Iad18fc6f2df4142368bdf1063b8cc71de2d66156 Also: fiddled with "must [not] be locked" on a recently-added function.
Diffstat (limited to 'vm/Thread.h')
-rw-r--r--vm/Thread.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/vm/Thread.h b/vm/Thread.h
index 44004bfd9..e2af2531d 100644
--- a/vm/Thread.h
+++ b/vm/Thread.h
@@ -441,13 +441,21 @@ Thread* dvmGetThreadFromThreadObject(Object* vmThreadObj);
/*
* Given a pthread handle, return the associated Thread*.
- * Caller must NOT hold the thread list lock.
+ * Caller must hold the thread list lock.
*
* Returns NULL if the thread was not found.
*/
Thread* dvmGetThreadByHandle(pthread_t handle);
/*
+ * Given a thread ID, return the associated Thread*.
+ * Caller must hold the thread list lock.
+ *
+ * Returns NULL if the thread was not found.
+ */
+Thread* dvmGetThreadByThreadId(u4 threadId);
+
+/*
* Sleep in a thread. Returns when the sleep timer returns or the thread
* is interrupted.
*/