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

Greg Clayton gclayton at apple.com
Fri Jul 23 08:43:25 PDT 2010


Author: gclayton
Date: Fri Jul 23 10:43:25 2010
New Revision: 109227

URL: http://llvm.org/viewvc/llvm-project?rev=109227&view=rev
Log:
Remove a premature invalidation of a threads pthread_t handle, thus avoiding
a segfault when calling pthread_cancel.  Also, sets m_read_thread_enabled if
the thread is actually spawned.

Patch from Stephen Wilson.


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=109227&r1=109226&r2=109227&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Fri Jul 23 10:43:25 2010
@@ -211,9 +211,9 @@
     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);
-    return m_read_thread != LLDB_INVALID_HOST_THREAD;
+    m_read_thread_enabled = m_read_thread != LLDB_INVALID_HOST_THREAD;
+    return m_read_thread_enabled;
 }
 
 bool
@@ -232,6 +232,7 @@
     Host::ThreadCancel (m_read_thread, error_ptr);
 
     return Host::ThreadJoin (m_read_thread, NULL, error_ptr);
+    m_read_thread = LLDB_INVALID_HOST_THREAD;
 }
 
 
@@ -339,7 +340,6 @@
         log->Printf ("%p Communication::ReadThread () thread exiting...", p);
 
     // Let clients know that this thread is exiting
-    comm->m_read_thread = LLDB_INVALID_HOST_THREAD;
     comm->BroadcastEvent (eBroadcastBitReadThreadDidExit);
     return NULL;
 }





More information about the lldb-commits mailing list