/* Multi-thread control defs for remote server for GDB.
- Copyright (C) 1993-2017 Free Software Foundation, Inc.
+ Copyright (C) 1993-2018 Free Software Foundation, Inc.
This file is part of GDB.
return NULL;
}
+/* Like the above, but only consider threads with pid PID. */
+
+template <typename Func>
+static thread_info *
+find_thread (int pid, Func func)
+{
+ return find_thread ([&] (thread_info *thread)
+ {
+ return thread->id.pid () == pid && func (thread);
+ });
+}
+
+/* Find the first thread that matches FILTER for which FUNC returns true.
+ Return NULL if no thread satisfying these conditions is found. */
+
+template <typename Func>
+static thread_info *
+find_thread (ptid_t filter, Func func)
+{
+ return find_thread ([&] (thread_info *thread) {
+ return thread->id.matches (filter) && func (thread);
+ });
+}
+
/* Invoke FUNC for each thread. */
template <typename Func>
}
}
+/* Like the above, but only consider threads with pid PID. */
+
+template <typename Func>
+static void
+for_each_thread (int pid, Func func)
+{
+ for_each_thread ([&] (thread_info *thread)
+ {
+ if (pid == thread->id.pid ())
+ func (thread);
+ });
+}
+
/* Find the a random thread for which FUNC (THREAD) returns true. If
no entry is found then return NULL. */
return thread->id.lwp ();
}
-/* Create a cleanup to restore current_thread. */
-struct cleanup *make_cleanup_restore_current_thread (void);
-
#endif /* GDB_THREAD_H */