summaryrefslogtreecommitdiffstats
path: root/runtime/debugger.cc
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2015-02-24 09:28:49 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-02-24 09:28:50 +0000
commit893bee6c8f05fdf7345bf348a8f9d24e9300bf8e (patch)
tree355c13610857333335851c7aa18fb73471f86529 /runtime/debugger.cc
parentf548c54c69443ba94fcee89daca6f5f499d71e9a (diff)
parent2bf93f48bbb417b358c9e3c77911ea6ec7307c15 (diff)
downloadart-893bee6c8f05fdf7345bf348a8f9d24e9300bf8e.tar.gz
art-893bee6c8f05fdf7345bf348a8f9d24e9300bf8e.tar.bz2
art-893bee6c8f05fdf7345bf348a8f9d24e9300bf8e.zip
Merge "JDWP: update thread synchronization"
Diffstat (limited to 'runtime/debugger.cc')
-rw-r--r--runtime/debugger.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index a3d3b470cc..13bbdeb407 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -605,7 +605,7 @@ Thread* Dbg::GetDebugThread() {
}
void Dbg::ClearWaitForEventThread() {
- gJdwpState->ClearWaitForEventThread();
+ gJdwpState->ReleaseJdwpTokenForEvent();
}
void Dbg::Connected() {
@@ -3644,6 +3644,11 @@ JDWP::JdwpError Dbg::InvokeMethod(JDWP::ObjectId thread_id, JDWP::ObjectId objec
thread_list->Resume(targetThread, true);
}
+ // The target thread is resumed but needs the JDWP token we're holding.
+ // We release it now and will acquire it again when the invocation is
+ // complete and the target thread suspends itself.
+ gJdwpState->ReleaseJdwpTokenForCommand();
+
// Wait for the request to finish executing.
while (req->invoke_needed) {
req->cond.Wait(self);
@@ -3653,6 +3658,10 @@ JDWP::JdwpError Dbg::InvokeMethod(JDWP::ObjectId thread_id, JDWP::ObjectId objec
/* wait for thread to re-suspend itself */
SuspendThread(thread_id, false /* request_suspension */);
+
+ // Now the thread is suspended again, we can re-acquire the JDWP token.
+ gJdwpState->AcquireJdwpTokenForCommand();
+
self->TransitionFromSuspendedToRunnable();
}
@@ -3660,7 +3669,7 @@ JDWP::JdwpError Dbg::InvokeMethod(JDWP::ObjectId thread_id, JDWP::ObjectId objec
* Suspend the threads. We waited for the target thread to suspend
* itself, so all we need to do is suspend the others.
*
- * The suspendAllThreads() call will double-suspend the event thread,
+ * The SuspendAllForDebugger() call will double-suspend the event thread,
* so we want to resume the target thread once to keep the books straight.
*/
if ((options & JDWP::INVOKE_SINGLE_THREADED) == 0) {