Now that inferior threads are stored in a map, change the
find_thread_ptid function to look up a thread using std::map::find,
instead of iterating on all of the inferior's threads.
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. */