Create JNIEnv*s on the right threads.
This exposes a bug in jni_compiler.cc --- it passes the right JNIEnv* to the
native method and to MonitorExit, but it passes a bogus value to MonitorEnter.
Change-Id: Icbf505d24294d14ce3e40180a20254789cb69904
diff --git a/src/thread.h b/src/thread.h
index 02b2f65..a6e137f 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -171,7 +171,7 @@
return runtime_;
}
- State GetState() {
+ State GetState() const {
return state_;
}
@@ -241,8 +241,11 @@
private:
Thread()
- : id_(1234), top_shb_(NULL), exception_(NULL), suspend_count_(0) {
- jni_env_ = CreateJNIEnv();
+ : id_(1234),
+ top_shb_(NULL),
+ jni_env_(NULL),
+ exception_(NULL),
+ suspend_count_(0) {
}
~Thread() {
@@ -304,6 +307,7 @@
DISALLOW_COPY_AND_ASSIGN(Thread);
};
+std::ostream& operator<<(std::ostream& os, const Thread& thread);
std::ostream& operator<<(std::ostream& os, const Thread::State& state);
class ThreadList {