Fixed a few places where we were doing:

uint32_t size = ThreadList.GetSize();
for (i=0; i < size; ++i)

without grabbing the thread list mutex.

llvm-svn: 163541
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index e744b58..f1d3eb3 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -792,14 +792,17 @@
                 }
             }
             
-            const uint32_t num_threads = process->GetThreadList().GetSize();
+            {  // Scope for thread list mutex:
+                Mutex::Locker locker (process->GetThreadList().GetMutex());
+                const uint32_t num_threads = process->GetThreadList().GetSize();
 
-            // Set the actions that the threads should each take when resuming
-            for (uint32_t idx=0; idx<num_threads; ++idx)
-            {
-                process->GetThreadList().GetThreadAtIndex(idx)->SetResumeState (eStateRunning);
+                // Set the actions that the threads should each take when resuming
+                for (uint32_t idx=0; idx<num_threads; ++idx)
+                {
+                    process->GetThreadList().GetThreadAtIndex(idx)->SetResumeState (eStateRunning);
+                }
             }
-
+            
             Error error(process->Resume());
             if (error.Success())
             {
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 7cb8273..93ecf36 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -185,6 +185,7 @@
         else if (command.GetArgumentCount() == 1 && ::strcmp (command.GetArgumentAtIndex(0), "all") == 0)
         {
             Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
+            Mutex::Locker locker (process->GetThreadList().GetMutex());
             uint32_t num_threads = process->GetThreadList().GetSize();
             for (uint32_t i = 0; i < num_threads; i++)
             {
@@ -208,6 +209,7 @@
         {
             uint32_t num_args = command.GetArgumentCount();
             Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
+            Mutex::Locker locker (process->GetThreadList().GetMutex());
             std::vector<ThreadSP> thread_sps;
 
             for (uint32_t i = 0; i < num_args; i++)
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 918f98c..da537ad 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -4860,6 +4860,7 @@
 {
     size_t num_thread_infos_dumped = 0;
     
+    Mutex::Locker locker (GetThreadList().GetMutex());
     const size_t num_threads = GetThreadList().GetSize();
     for (uint32_t i = 0; i < num_threads; i++)
     {