Make the "synchronous" mode actually work without race conditions.

There were many issues with synchronous mode that we discovered when started to try and add a "batch" mode. There was a race condition where the event handling thread might consume events when in sync mode and other times the Process::WaitForProcessToStop() would consume them. This also led to places where the Process IO handler might or might not get popped when it needed to be.

llvm-svn: 220254
This commit is contained in:
Greg Clayton
2014-10-21 01:00:42 +00:00
parent f16a66973c
commit dc6224e0a3
13 changed files with 355 additions and 248 deletions

View File

@@ -739,18 +739,10 @@ SBProcess::Continue ()
{
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
Error error (process_sp->Resume());
if (error.Success())
{
if (process_sp->GetTarget().GetDebugger().GetAsyncExecution () == false)
{
if (log)
log->Printf ("SBProcess(%p)::Continue () waiting for process to stop...",
static_cast<void*>(process_sp.get()));
process_sp->WaitForProcessToStop (NULL);
}
}
sb_error.SetError(error);
if (process_sp->GetTarget().GetDebugger().GetAsyncExecution ())
sb_error.ref() = process_sp->Resume ();
else
sb_error.ref() = process_sp->ResumeSynchronous (NULL);
}
else
sb_error.SetErrorString ("SBProcess is invalid");