[Lldb-commits] [lldb] r121647 - /lldb/trunk/source/Core/Communication.cpp
gclayton at apple.com
Sun Dec 12 13:50:58 PST 2010
Date: Sun Dec 12 15:50:57 2010
New Revision: 121647
Fixed a multi-threaded race condition that could happen when communication classes are shutting down. We currently don't protect communication connection classes against multi-threaded access. The connection is stored in the lldb_private::Communication.m_connection_ap auto_ptr member. We either need to add protections when accessing this class or not let anything racy occur. With this fix, we are doing the latter.
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Sun Dec 12 15:50:57 2010
@@ -94,7 +94,16 @@
ConnectionStatus status = m_connection_ap->Disconnect (error_ptr);
+ // We currently don't protect m_connection_ap with any mutex for
+ // multi-threaded environments. So lets not nuke our connection class
+ // without putting some multi-threaded protections in. We also probably
+ // don't want to pay for the overhead it might cause if every time we
+ // access the connection we have to take a lock.
+ // This auto_ptr will cleanup after itself when this object goes away,
+ // so there is no need to currently have it destroy itself immediately
+ // upon disconnnect.
@@ -347,6 +356,7 @@
// Let clients know that this thread is exiting
comm->m_read_thread = LLDB_INVALID_HOST_THREAD;
More information about the lldb-commits