[Lldb-commits] [lldb] [lldb] Make the PluginManager thread safe (PR #184452)

John Harrison via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 3 16:47:08 PST 2026


================
@@ -511,31 +513,61 @@ template <typename Instance> class PluginInstances {
   }
 
   typename Instance::CallbackType GetCallbackAtIndex(uint32_t idx) {
-    if (const Instance *instance = GetInstanceAtIndex(idx))
-      return instance->create_callback;
+    std::lock_guard<std::mutex> lock(m_mutex);
+    uint32_t count = 0;
+    for (const auto &instance : m_instances) {
+      if (!instance.enabled)
+        continue;
----------------
ashgti wrote:

This pattern is repeated a few times here and below, could we use `GetSnapshot()` to simplify this?

https://github.com/llvm/llvm-project/pull/184452


More information about the lldb-commits mailing list