Make find_thread_ptid lookup thread map instead of iterate
[deliverable/binutils-gdb.git] / gdb / thread.c
index 20b83ea3afc2dee708d53c4050c7ece55ca12231..f0d331ee3a1839d644202867e9d0fd3fc2db96dd 100644 (file)
@@ -533,11 +533,11 @@ find_thread_ptid (process_stratum_target *targ, ptid_t ptid)
 struct thread_info *
 find_thread_ptid (inferior *inf, ptid_t ptid)
 {
-  for (thread_info *tp : inf->threads ())
-    if (tp->ptid == ptid)
-      return tp;
-
-  return NULL;
+  auto it = inf->thread_map.find (ptid);
+  if (it != inf->thread_map.end ())
+    return it->second;
+  else
+    return nullptr;
 }
 
 /* See gdbthread.h.  */
This page took 0.024244 seconds and 4 git commands to generate.