[Lldb-commits] [lldb] r185107 - Prevent race in when stopping a "read thread"

Tim Northover tnorthover at apple.com
Thu Jun 27 14:19:30 PDT 2013


Author: tnorthover
Date: Thu Jun 27 16:19:30 2013
New Revision: 185107

URL: http://llvm.org/viewvc/llvm-project?rev=185107&view=rev
Log:
Prevent race in when stopping a "read thread"

Both StopReadThread and the thread being stopped set the thread id to
0 after m_read_thread_enabled was set to false. If the thread being
stopped got there first then StopReadThread called pthread_join on an
invalid thread number. This is not a Good Thing,

Should fix a fairly regular segfault when quitting on Linux.

Modified:
    lldb/trunk/source/Core/Communication.cpp

Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=185107&r1=185106&r2=185107&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Thu Jun 27 16:19:30 2013
@@ -390,8 +390,6 @@ Communication::ReadThread (void *p)
 
     // Let clients know that this thread is exiting
     comm->BroadcastEvent (eBroadcastBitReadThreadDidExit);
-    comm->m_read_thread_enabled = false;
-    comm->m_read_thread = LLDB_INVALID_HOST_THREAD;
     return NULL;
 }
 





More information about the lldb-commits mailing list