More SIGQUIT detail, earlier exit in AttachCurrentThread, handling recursive aborts, and reporting debug/optimized builds.
Change-Id: I932b49a8e92a91e340b4d98b8771dd4a41b61229
diff --git a/src/thread.cc b/src/thread.cc
index 538aaa8..e43aa14 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -246,6 +246,8 @@
}
void Thread::Attach(const Runtime* runtime) {
+ CHECK(Thread::Current() == NULL);
+
InitCpu();
InitFunctionPointers();
InitCardTable();
@@ -263,21 +265,18 @@
}
Thread* Thread::Attach(const Runtime* runtime, const char* name, bool as_daemon) {
- Thread* self = Thread::Current();
- if (self == NULL) {
- self = new Thread;
- self->Attach(runtime);
+ Thread* self = new Thread;
+ self->Attach(runtime);
- self->SetState(Thread::kNative);
+ self->SetState(Thread::kNative);
- // If we're the main thread, ClassLinker won't be created until after we're attached,
- // so that thread needs a two-stage attach. Regular threads don't need this hack.
- if (self->thin_lock_id_ != ThreadList::kMainId) {
- self->CreatePeer(name, as_daemon);
- }
-
- self->GetJniEnv()->locals.AssertEmpty();
+ // If we're the main thread, ClassLinker won't be created until after we're attached,
+ // so that thread needs a two-stage attach. Regular threads don't need this hack.
+ if (self->thin_lock_id_ != ThreadList::kMainId) {
+ self->CreatePeer(name, as_daemon);
}
+
+ self->GetJniEnv()->locals.AssertEmpty();
return self;
}