summaryrefslogtreecommitdiffstats
path: root/src/monitor.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2012-02-07 09:25:29 -0800
committerIan Rogers <irogers@google.com>2012-02-07 11:30:53 -0800
commit6d0b13e931fb73d5e964d14b0a7ecd1f3f5db547 (patch)
tree56c2c2a889df39662397c7fe97acf77b90d0ff8d /src/monitor.h
parentfe1b29c35c7bbfa102ae48c5159056634bc28a08 (diff)
downloadart-6d0b13e931fb73d5e964d14b0a7ecd1f3f5db547.zip
art-6d0b13e931fb73d5e964d14b0a7ecd1f3f5db547.tar.gz
art-6d0b13e931fb73d5e964d14b0a7ecd1f3f5db547.tar.bz2
Increase debug information for failed monitor exits
CTS has shown IllegalMonitorStateExceptions where they shouldn't occur. Ratchet up the debug information in the case of unlocks so the kind of problem can be better diagnosed. This code is only executed in exceptional cases and so better debugging wins out over performance. Also, add helper to dump thread state as something human readable. Also, JNI internal unit test of monitor enter/exit. Change-Id: I9c06fbce7e6c9ebbb950a4e400f65c791ebe2ba4
Diffstat (limited to 'src/monitor.h')
-rw-r--r--src/monitor.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/monitor.h b/src/monitor.h
index 4d73e37..a79f6ce 100644
--- a/src/monitor.h
+++ b/src/monitor.h
@@ -89,6 +89,8 @@ class Monitor {
void LogContentionEvent(Thread* self, uint32_t wait_ms, uint32_t sample_percent, const char* owner_filename, uint32_t owner_line_number);
+ static void FailedUnlock(Object* obj, Thread* expected_owner, Thread* found_owner, Monitor* mon);
+
void Lock(Thread* self);
bool Unlock(Thread* thread);
@@ -105,13 +107,13 @@ class Monitor {
static uint32_t lock_profiling_threshold_;
// Which thread currently owns the lock?
- Thread* owner_;
+ Thread* volatile owner_;
// Owner's recursive lock depth.
int lock_count_;
// What object are we part of (for debugging).
- Object* obj_;
+ Object* const obj_;
// Threads currently waiting on this monitor.
Thread* wait_set_;