diff options
| author | Andy McFadden <fadden@android.com> | 2010-03-12 13:39:59 -0800 |
|---|---|---|
| committer | Andy McFadden <fadden@android.com> | 2010-03-15 11:59:23 -0700 |
| commit | 0a24ef9d1a88984dae3f7a9bf431c82626eadb2e (patch) | |
| tree | 8db67ef0dba186d7099850ea0eec6cbe45b20cba /vm/Thread.h | |
| parent | fcfb52201103bf732a6233ea45daaa65e253543b (diff) | |
| download | android_dalvik-0a24ef9d1a88984dae3f7a9bf431c82626eadb2e.tar.gz android_dalvik-0a24ef9d1a88984dae3f7a9bf431c82626eadb2e.tar.bz2 android_dalvik-0a24ef9d1a88984dae3f7a9bf431c82626eadb2e.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)
Also: fiddled with "must [not] be locked" on a recently-added function.
(cherry-picked from dalvik-dev)
Change-Id: Ic16695741760d50be70e70fb7470972cef28bb09
Diffstat (limited to 'vm/Thread.h')
| -rw-r--r-- | vm/Thread.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/vm/Thread.h b/vm/Thread.h index 2d6ce5f25..f397fba70 100644 --- a/vm/Thread.h +++ b/vm/Thread.h @@ -438,13 +438,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. */ |
