From 1a76d598884a052dacd8feb49f1999e1a0d537f1 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Thu, 10 Jul 2014 11:15:32 -0700 Subject: [PATCH] * gdbthread.h (any_running): Declare. * thread.c (any_running): New function. --- gdb/ChangeLog | 5 +++++ gdb/gdbthread.h | 3 +++ gdb/thread.c | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 56f29095d61..63cbdcb4a69 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-07-10 Doug Evans + + * gdbthread.h (any_running): Declare. + * thread.c (any_running): New function. + 2014-07-09 Pedro Alves * infcmd.c (attach_command_post_wait): Don't call diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index 9ef74cdd686..ca529831aaa 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -363,6 +363,9 @@ extern int is_exited (ptid_t ptid); /* In the frontend's perpective, is this thread stopped? */ extern int is_stopped (ptid_t ptid); +/* In the frontend's perpective is there any thread running? */ +extern int any_running (void); + /* Marks thread PTID as executing, or not. If ptid_get_pid (PTID) is -1, marks all threads. diff --git a/gdb/thread.c b/gdb/thread.c index e25d5639bd9..532149ddc63 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -647,6 +647,18 @@ is_running (ptid_t ptid) return is_thread_state (ptid, THREAD_RUNNING); } +int +any_running (void) +{ + struct thread_info *tp; + + for (tp = thread_list; tp; tp = tp->next) + if (tp->state == THREAD_RUNNING) + return 1; + + return 0; +} + int is_executing (ptid_t ptid) { -- 2.30.2