Fix iohandler prompt race condition.
This issue caused the lldb prompt to not show up in certain cases, very
noticeable on Linux systems.
See details on this review:
http://reviews.llvm.org/D4863
And on this lldb-commits thread:
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140811/012306.html
Change by Shawn Best.
(Much useful help and testing by the rest of the community, thanks all!)
llvm-svn: 215446
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index f959010..e3fd790 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -2420,9 +2420,14 @@
m_process_sp->RestoreProcessEvents ();
error = m_process_sp->PrivateResume();
-
+
if (error.Success())
{
+ // there is a race condition where this thread will return up the call stack to the main command
+ // handler and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has
+ // a chance to call PushProcessIOHandler()
+ m_process_sp->SyncIOHandler(2000);
+
if (synchronous_execution)
{
state = m_process_sp->WaitForProcessToStop (NULL, NULL, true, hijack_listener_sp.get());