diff options
author | 2014-08-27 23:43:46 -0700 | |
---|---|---|
committer | 2014-08-28 15:37:27 -0700 | |
commit | ba32de47e32f436d7c11cb4a2e78bdd4ad4dc5d2 (patch) | |
tree | 1b56397dfce317d2034feebfb2191bcb09b78823 /runtime/debugger.cc | |
parent | 14515d738dadf88e3e00b7dd1bd69899c4df4b91 (diff) |
Fix issue with Thread.setName hanging after Thread.start
When suspending a thread by peer the invariant that only attached threads are
suspended must be maintained. Add a ThreadList::Contains check which requires
making this method non-static.
Add some extra thread logging.
Bug: 17302037
(cherry picked from commit 37c16453a92bbf1a47f042000318a1b60381017d)
Change-Id: I51832785d4b4b431e035318e75635f442e89a1fb
Diffstat (limited to 'runtime/debugger.cc')
-rw-r--r-- | runtime/debugger.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc index ffd15f638a..9136f9f8d8 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -2281,8 +2281,9 @@ JDWP::JdwpError Dbg::SuspendThread(JDWP::ObjectId thread_id, bool request_suspen // trying to suspend this one. MutexLock mu(self, *Locks::thread_list_suspend_thread_lock_); bool timed_out; - Thread* thread = ThreadList::SuspendThreadByPeer(peer.get(), request_suspension, true, - &timed_out); + ThreadList* thread_list = Runtime::Current()->GetThreadList(); + Thread* thread = thread_list->SuspendThreadByPeer(peer.get(), request_suspension, true, + &timed_out); if (thread != NULL) { return JDWP::ERR_NONE; } else if (timed_out) { @@ -3171,8 +3172,8 @@ class ScopedThreadSuspension { { // Take suspend thread lock to avoid races with threads trying to suspend this one. MutexLock mu(soa.Self(), *Locks::thread_list_suspend_thread_lock_); - suspended_thread = ThreadList::SuspendThreadByPeer(thread_peer, true, true, - &timed_out); + ThreadList* thread_list = Runtime::Current()->GetThreadList(); + suspended_thread = thread_list->SuspendThreadByPeer(thread_peer, true, true, &timed_out); } CHECK_EQ(soa.Self()->TransitionFromSuspendedToRunnable(), kWaitingForDebuggerSuspension); if (suspended_thread == nullptr) { |