diff options
Diffstat (limited to 'gdb/gdbserver/gdbthread.h')
-rw-r--r-- | gdb/gdbserver/gdbthread.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gdb/gdbserver/gdbthread.h b/gdb/gdbserver/gdbthread.h index 8ace051..b82d5b0 100644 --- a/gdb/gdbserver/gdbthread.h +++ b/gdb/gdbserver/gdbthread.h @@ -111,6 +111,18 @@ find_thread (Func func) 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); + }); +} + /* Invoke FUNC for each thread. */ template <typename Func> @@ -128,6 +140,19 @@ for_each_thread (Func 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. */ |