if (process == nullptr)
return nullptr;
- auto &thread_map = process->thread_map ();
-
- if (auto it = thread_map.find (ptid);
- it != thread_map.end ())
- return it->second;
-
- return nullptr;
+ return process->find_thread (ptid);
}
/* Find a thread associated with the given PROCESS, or NULL if no
/* See inferiors.h. */
+thread_info *
+process_info::find_thread (ptid_t ptid)
+{
+ if (auto it = m_ptid_thread_map.find (ptid);
+ it != m_ptid_thread_map.end ())
+ return it->second;
+
+ return nullptr;
+}
+
+/* See inferiors.h. */
+
thread_info *
process_info::find_thread (gdb::function_view<bool (thread_info *)> func)
{
if (filter.is_pid ())
return process->find_thread (func);
- auto &thread_map = process->thread_map ();
-
- if (auto it = thread_map.find (filter);
- it != thread_map.end () && func (it->second))
- return it->second;
+ if (thread_info *thread = process->find_thread (filter);
+ thread != nullptr && func (thread))
+ return thread;
return nullptr;
}
std::unordered_map<ptid_t, thread_info *> &thread_map ()
{ return m_ptid_thread_map; }
+ /* Return the thread with ptid PTID, or nullptr if no such thread is
+ found. */
+ thread_info *find_thread (ptid_t ptid);
+
/* Find the first thread for which FUNC returns true. Return nullptr if no
such thread is found. */
thread_info *find_thread (gdb::function_view<bool (thread_info *)> func);