summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Communication.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-09-15 05:19:45 +0000
committerGreg Clayton <gclayton@apple.com>2010-09-15 05:19:45 +0000
commit86c3f345c6e1e8f16fdc364c5a7556b68a7e588d (patch)
treef8f9dc3f3514e9c893a834b67be656902e9ffab3 /lldb/source/Core/Communication.cpp
parent6757eae45e0ef3bde0de6789f45252f5b495bc78 (diff)
downloadbcm5719-llvm-86c3f345c6e1e8f16fdc364c5a7556b68a7e588d.tar.gz
bcm5719-llvm-86c3f345c6e1e8f16fdc364c5a7556b68a7e588d.zip
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
Diffstat (limited to 'lldb/source/Core/Communication.cpp')
-rw-r--r--lldb/source/Core/Communication.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp
index d05eb3b1556..4ebced118a4 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), "<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;
}
OpenPOWER on IntegriCloud