Remove usage of find_inferior in unsuspend_all_lwps
authorSimon Marchi <simon.marchi@ericsson.com>
Mon, 20 Nov 2017 03:23:24 +0000 (22:23 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 20 Nov 2017 03:23:24 +0000 (22:23 -0500)
Replace with for_each_thread.  I inlined unsuspend_one_lwp in
unsuspend_all_lwps, since it is very simple.

gdb/gdbserver/ChangeLog:

* linux-low.c (unsuspend_one_lwp): Remove.
(unsuspend_all_lwps): Use for_each_thread, inline code from
unsuspend_one_lwp.

gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c

index 5183022ce03e3e4d566a6feec197668443006d53..f824cff26d64726b37c186b026f841429ffdaf1c 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-19  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * linux-low.c (unsuspend_one_lwp): Remove.
+       (unsuspend_all_lwps): Use for_each_thread, inline code from
+       unsuspend_one_lwp.
+
 2017-11-19  Simon Marchi  <simon.marchi@ericsson.com>
 
        * gdbthread.h (find_thread): Add overload with ptid_t filter.
index fd8e45e37c91432bc6cc4939cb5bec8898850d75..fce3fd083356c7fecf29bda5b3854e10772a449b 100644 (file)
@@ -2969,28 +2969,19 @@ select_event_lwp (struct lwp_info **orig_lp)
     }
 }
 
-/* Decrement the suspend count of an LWP.  */
-
-static int
-unsuspend_one_lwp (thread_info *thread, void *except)
-{
-  struct lwp_info *lwp = get_thread_lwp (thread);
-
-  /* Ignore EXCEPT.  */
-  if (lwp == except)
-    return 0;
-
-  lwp_suspended_decr (lwp);
-  return 0;
-}
-
 /* Decrement the suspend count of all LWPs, except EXCEPT, if non
    NULL.  */
 
 static void
 unsuspend_all_lwps (struct lwp_info *except)
 {
-  find_inferior (&all_threads, unsuspend_one_lwp, except);
+  for_each_thread ([&] (thread_info *thread)
+    {
+      lwp_info *lwp = get_thread_lwp (thread);
+
+      if (lwp != except)
+       lwp_suspended_decr (lwp);
+    });
 }
 
 static void move_out_of_jump_pad_callback (thread_info *thread);