diff options
author | Greg Clayton <gclayton@apple.com> | 2012-04-09 20:22:01 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-04-09 20:22:01 +0000 |
commit | 0cd70866041cb69b52e51ac0a486e16aee3ae84a (patch) | |
tree | 3aa8c6eae52f42dbc99c5504da7e656314e3d6c4 /lldb/source/Core/ModuleList.cpp | |
parent | 3ad11ff90f115a11149c5abe04d46579ff387ebd (diff) | |
download | bcm5719-llvm-0cd70866041cb69b52e51ac0a486e16aee3ae84a.tar.gz bcm5719-llvm-0cd70866041cb69b52e51ac0a486e16aee3ae84a.zip |
<rdar://problem/11202426>
Work around a deadlocking issue where "SBDebugger::MemoryPressureDetected ()" is being called and is causing a deadlock. We now just try and get the lock when trying to trim down the unique modules so we don't deadlock debugger GUI programs until we can find the root cause.
llvm-svn: 154339
Diffstat (limited to 'lldb/source/Core/ModuleList.cpp')
-rw-r--r-- | lldb/source/Core/ModuleList.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 69245fb1a95..5e4f660dd28 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -112,9 +112,20 @@ ModuleList::Remove (const ModuleSP &module_sp) size_t -ModuleList::RemoveOrphans () +ModuleList::RemoveOrphans (bool mandatory) { - Mutex::Locker locker(m_modules_mutex); + Mutex::Locker locker; + + if (mandatory) + { + locker.Reset (m_modules_mutex.GetMutex()); + } + else + { + // Not mandatory, remove orphans if we can get the mutex + if (!locker.TryLock(m_modules_mutex.GetMutex())) + return 0; + } collection::iterator pos = m_modules.begin(); size_t remove_count = 0; while (pos != m_modules.end()) @@ -587,9 +598,9 @@ ModuleList::FindSharedModules (const ModuleSpec &module_spec, ModuleList &matchi } uint32_t -ModuleList::RemoveOrphanSharedModules () +ModuleList::RemoveOrphanSharedModules (bool mandatory) { - return GetSharedModuleList ().RemoveOrphans(); + return GetSharedModuleList ().RemoveOrphans(mandatory); } Error |