[Lldb-commits] [lldb] r113947 - /lldb/trunk/source/Core/Communication.cpp

Greg Clayton gclayton at apple.com
Tue Sep 14 22:19:45 PDT 2010

Author: gclayton
Date: Wed Sep 15 00:19:45 2010
New Revision: 113947

URL: http://llvm.org/viewvc/llvm-project?rev=113947&view=rev
Fixed a race condition that was sometimes stopping our command line 
interpreter from working. The communication read thread could
startup and immediately exit if m_read_thread_enabled was
checked in the thread function before it was set by the
thread that spawns the read thread. Now m_read_thread_enabled is set
to true prior to spawning the read thread to avoid this issue.

Hopefully this will clear up the sporatic failures in our test suite.


Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=113947&r1=113946&r2=113947&view=diff
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Wed Sep 15 00:19:45 2010
@@ -211,8 +211,10 @@
     char thread_name[1024];
     snprintf(thread_name, sizeof(thread_name), "<lldb.comm.%s>", m_broadcaster_name.AsCString());
+    m_read_thread_enabled = true;
     m_read_thread = Host::ThreadCreate (thread_name, Communication::ReadThread, this, error_ptr);
-    m_read_thread_enabled = m_read_thread != LLDB_INVALID_HOST_THREAD;
+    if (m_read_thread == LLDB_INVALID_HOST_THREAD)
+        m_read_thread_enabled = false;
     return m_read_thread_enabled;

More information about the lldb-commits mailing list