summaryrefslogtreecommitdiffstats
path: root/runtime/thread_list.cc
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2014-07-28 18:35:38 -0700
committerJeff Hao <jeffhao@google.com>2014-07-29 13:34:57 -0700
commitc5d824a20c225763761a6dff43294b229ff35469 (patch)
treed3fcf29c2e7359bdb135931c0f4558644e1ca9fb /runtime/thread_list.cc
parent8df73882c60451e7f789bf9b1f3db2d7dc228640 (diff)
downloadart-c5d824a20c225763761a6dff43294b229ff35469.zip
art-c5d824a20c225763761a6dff43294b229ff35469.tar.gz
art-c5d824a20c225763761a6dff43294b229ff35469.tar.bz2
Stop thread from reattaching during runtime shutdown while tracing.
Bug: 16024763 Change-Id: Iad5ba180241ff74b15baf5c3a15ed2d2ed60fcf0
Diffstat (limited to 'runtime/thread_list.cc')
-rw-r--r--runtime/thread_list.cc35
1 files changed, 27 insertions, 8 deletions
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index ff1a079..7cf26e6 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -294,16 +294,19 @@ size_t ThreadList::RunCheckpointOnRunnableThreads(Closure* checkpoint_function)
void ThreadList::SuspendAll() {
Thread* self = Thread::Current();
- DCHECK(self != nullptr);
- VLOG(threads) << *self << " SuspendAll starting...";
+ if (self != nullptr) {
+ VLOG(threads) << *self << " SuspendAll starting...";
+ } else {
+ VLOG(threads) << "Thread[null] SuspendAll starting...";
+ }
ATRACE_BEGIN("Suspending mutator threads");
uint64_t start_time = NanoTime();
Locks::mutator_lock_->AssertNotHeld(self);
Locks::thread_list_lock_->AssertNotHeld(self);
Locks::thread_suspend_count_lock_->AssertNotHeld(self);
- if (kDebugLocking) {
+ if (kDebugLocking && self != nullptr) {
CHECK_NE(self->GetState(), kRunnable);
}
{
@@ -344,14 +347,21 @@ void ThreadList::SuspendAll() {
ATRACE_END();
ATRACE_BEGIN("Mutator threads suspended");
- VLOG(threads) << *self << " SuspendAll complete";
+ if (self != nullptr) {
+ VLOG(threads) << *self << " SuspendAll complete";
+ } else {
+ VLOG(threads) << "Thread[null] SuspendAll complete";
+ }
}
void ThreadList::ResumeAll() {
Thread* self = Thread::Current();
- DCHECK(self != nullptr);
- VLOG(threads) << *self << " ResumeAll starting";
+ if (self != nullptr) {
+ VLOG(threads) << *self << " ResumeAll starting";
+ } else {
+ VLOG(threads) << "Thread[null] ResumeAll starting";
+ }
ATRACE_END();
ATRACE_BEGIN("Resuming mutator threads");
@@ -377,11 +387,20 @@ void ThreadList::ResumeAll() {
// Broadcast a notification to all suspended threads, some or all of
// which may choose to wake up. No need to wait for them.
- VLOG(threads) << *self << " ResumeAll waking others";
+ if (self != nullptr) {
+ VLOG(threads) << *self << " ResumeAll waking others";
+ } else {
+ VLOG(threads) << "Thread[null] ResumeAll waking others";
+ }
Thread::resume_cond_->Broadcast(self);
}
ATRACE_END();
- VLOG(threads) << *self << " ResumeAll complete";
+
+ if (self != nullptr) {
+ VLOG(threads) << *self << " ResumeAll complete";
+ } else {
+ VLOG(threads) << "Thread[null] ResumeAll complete";
+ }
}
void ThreadList::Resume(Thread* thread, bool for_debugger) {