summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/ModuleList.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-06-27 19:59:26 +0000
committerGreg Clayton <gclayton@apple.com>2012-06-27 19:59:26 +0000
commit8921ce83963f2f0cecbeb93f405098a2d3d9d20e (patch)
tree650c68d5d14add7152b2dbde8e49b30bdd302dc4 /lldb/source/Core/ModuleList.cpp
parent89d4f338a77829f70b46297649e5b237d12be22b (diff)
downloadbcm5719-llvm-8921ce83963f2f0cecbeb93f405098a2d3d9d20e.tar.gz
bcm5719-llvm-8921ce83963f2f0cecbeb93f405098a2d3d9d20e.zip
Fix the copy constructor and assignement operator for ModuleList to be thread safe.
llvm-svn: 159285
Diffstat (limited to 'lldb/source/Core/ModuleList.cpp')
-rw-r--r--lldb/source/Core/ModuleList.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 157dafa7a2c..44f34e62d82 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -37,8 +37,12 @@ ModuleList::ModuleList() :
// 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 @@ ModuleList::operator= (const ModuleList& rhs)
{
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;
OpenPOWER on IntegriCloud