summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/ModuleList.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2015-02-13 01:19:24 +0000
committerGreg Clayton <gclayton@apple.com>2015-02-13 01:19:24 +0000
commitd6346e6f3ef8d46d91b582b089a6aabe91369624 (patch)
tree11698c0b2512423e1719cc3bae00bf956bca5626 /lldb/source/Core/ModuleList.cpp
parentf14b9c7cc16f24357f2c7db95e84015f79be8b38 (diff)
downloadbcm5719-llvm-d6346e6f3ef8d46d91b582b089a6aabe91369624.tar.gz
bcm5719-llvm-d6346e6f3ef8d46d91b582b089a6aabe91369624.zip
Add a ModuleList::ForEach(...) which takes the module list mutex calls the std::function argument with each module. If you return true in the callback, iteration will continue, if you return false, iteration will stop and the lock will be released.
<rdar://problem/19213054> llvm-svn: 229008
Diffstat (limited to 'lldb/source/Core/ModuleList.cpp')
-rw-r--r--lldb/source/Core/ModuleList.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 879eb9bd182..5c8e0e0ca8e 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -1162,3 +1162,15 @@ ModuleList::LoadScriptingResourcesInTarget (Target *target,
}
return errors.size() == 0;
}
+
+void
+ModuleList::ForEach (std::function <bool (const ModuleSP &module_sp)> const &callback) const
+{
+ Mutex::Locker locker(m_modules_mutex);
+ for (const auto &module : m_modules)
+ {
+ // If the callback returns false, then stop iterating and break out
+ if (!callback (module))
+ break;
+ }
+}
OpenPOWER on IntegriCloud