From 86c3f345c6e1e8f16fdc364c5a7556b68a7e588d Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Wed, 15 Sep 2010 05:19:45 +0000 Subject: [PATCH] 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. llvm-svn: 113947 --- lldb/source/Core/Communication.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp index d05eb3b1556f..4ebced118a4e 100644 --- a/lldb/source/Core/Communication.cpp +++ b/lldb/source/Core/Communication.cpp @@ -211,8 +211,10 @@ Communication::StartReadThread (Error *error_ptr) char thread_name[1024]; snprintf(thread_name, sizeof(thread_name), "", 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; } -- GitLab