clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.


================
Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:1826-1827
+        for (size_t i = 0; i < num_threads; ++i) {
+          ThreadSP mem_thread = m_thread_list.GetThreadAtIndex(i, false);
+          if (mem_thread && mem_thread->GetBackingThread() == thread_sp)
+            thread_sp = mem_thread;
----------------
I would add a new function to ThreadList:

```
ThreadSP ThreadList::GetBackingThread(const ThreadSP &real_thread);
```

Since there is a mutex inside the thread list, we don't want another thread to 
be able to mutate the thread list while doing this iteration. So this code 
would become:

```
ThreadSP memory_thread_sp = m_thread_list.GetBackingThread(thread_sp);
if (memory_thread_sp)
  thread_sp = memory_thread_sp;
```



Repository:
  rL LLVM

https://reviews.llvm.org/D45497



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to