fjricci updated this revision to Diff 50387.
fjricci added a comment.

Remove duplication of index variable


http://reviews.llvm.org/D18075

Files:
  source/Commands/CommandObjectThread.cpp

Index: source/Commands/CommandObjectThread.cpp
===================================================================
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -72,15 +72,18 @@
         else if (command.GetArgumentCount() == 1 && ::strcmp 
(command.GetArgumentAtIndex(0), "all") == 0)
         {
             Process *process = m_exe_ctx.GetProcessPtr();
-            uint32_t idx = 0;
-            for (ThreadSP thread_sp : process->Threads())
+
+            // Manually iterate to avoid locking the threadlist,
+            // which can cause deadlocks when JIT-ing code
+            ThreadList thread_list = process->GetThreadList();
+            for (uint32_t idx = 0; idx < thread_list.GetSize(); ++idx)
             {
+                ThreadSP thread_sp = thread_list.GetThreadAtIndex(idx);
                 if (idx != 0 && m_add_return)
                     result.AppendMessage("");
 
                 if (!HandleOneThread(*(thread_sp.get()), result))
                     return false;
-                ++idx;
             }
         }
         else


Index: source/Commands/CommandObjectThread.cpp
===================================================================
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -72,15 +72,18 @@
         else if (command.GetArgumentCount() == 1 && ::strcmp (command.GetArgumentAtIndex(0), "all") == 0)
         {
             Process *process = m_exe_ctx.GetProcessPtr();
-            uint32_t idx = 0;
-            for (ThreadSP thread_sp : process->Threads())
+
+            // Manually iterate to avoid locking the threadlist,
+            // which can cause deadlocks when JIT-ing code
+            ThreadList thread_list = process->GetThreadList();
+            for (uint32_t idx = 0; idx < thread_list.GetSize(); ++idx)
             {
+                ThreadSP thread_sp = thread_list.GetThreadAtIndex(idx);
                 if (idx != 0 && m_add_return)
                     result.AppendMessage("");
 
                 if (!HandleOneThread(*(thread_sp.get()), result))
                     return false;
-                ++idx;
             }
         }
         else
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to