diff options
Diffstat (limited to 'runtime/jdwp/jdwp_handler.cc')
-rw-r--r-- | runtime/jdwp/jdwp_handler.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/jdwp/jdwp_handler.cc b/runtime/jdwp/jdwp_handler.cc index 0ff78d0..4b170ba 100644 --- a/runtime/jdwp/jdwp_handler.cc +++ b/runtime/jdwp/jdwp_handler.cc @@ -1685,6 +1685,12 @@ void JdwpState::ProcessRequest(Request& request, ExpandBuf* pReply) { SetWaitForEventThread(0); /* + * We do not want events to be sent while we process a request. Indicate the JDWP thread starts + * to process a request so other threads wait for it to finish before sending an event. + */ + StartProcessingRequest(); + + /* * Tell the VM that we're running and shouldn't be interrupted by GC. * Do this after anything that can stall indefinitely. */ @@ -1779,9 +1785,15 @@ void JdwpState::WaitForProcessingRequest() { Thread* self = Thread::Current(); CHECK_NE(self, GetDebugThread()) << "Events should not be posted by debug thread"; MutexLock mu(self, process_request_lock_); + bool waited = false; while (processing_request_) { + VLOG(jdwp) << StringPrintf("wait for processing request"); + waited = true; process_request_cond_.Wait(self); } + if (waited) { + VLOG(jdwp) << StringPrintf("finished waiting for processing request"); + } CHECK_EQ(processing_request_, false); } |