[Lldb-commits] [lldb] r159285 - /lldb/trunk/source/Core/ModuleList.cpp

Greg Clayton gclayton at apple.com
Wed Jun 27 12:59:26 PDT 2012


Author: gclayton
Date: Wed Jun 27 14:59:26 2012
New Revision: 159285

URL: http://llvm.org/viewvc/llvm-project?rev=159285&view=rev
Log:
Fix the copy constructor and assignement operator for ModuleList to be thread safe.


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

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=159285&r1=159284&r2=159285&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Wed Jun 27 14:59:26 2012
@@ -37,8 +37,12 @@
 // Copy constructor
 //----------------------------------------------------------------------
 ModuleList::ModuleList(const ModuleList& rhs) :
-    m_modules(rhs.m_modules)
+    m_modules(),
+    m_modules_mutex (Mutex::eMutexTypeRecursive)
 {
+    Mutex::Locker lhs_locker(m_modules_mutex);
+    Mutex::Locker rhs_locker(rhs.m_modules_mutex);
+    m_modules = rhs.m_modules;
 }
 
 //----------------------------------------------------------------------
@@ -49,7 +53,8 @@
 {
     if (this != &rhs)
     {
-        Mutex::Locker locker(m_modules_mutex);
+        Mutex::Locker lhs_locker(m_modules_mutex);
+        Mutex::Locker rhs_locker(rhs.m_modules_mutex);
         m_modules = rhs.m_modules;
     }
     return *this;





More information about the lldb-commits mailing list