From 80d03917838c16ee0da53a4a8642d5df3bee724e Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Mon, 27 Feb 2023 16:11:37 -0700 Subject: Introduce set_force_quit_flag and change type of sync_quit_force_run At the moment, handle_sigterm() in event-top.c does the following: sync_quit_force_run = 1; set_quit_flag (); This was used several more times in a later patch in this series, so I'm introducing (at Pedro's suggestion) a new function named 'set_force_quit_flag'. It simply sets sync_quit_force_run and also calls set_quit_flag(). I've revised the later patch to call set_force_quit_flag instead. I noticed that sync_quit_force_run is declared as an int but is being used as a bool, so I also changed its type to bool in this commit. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26761 Approved-By: Pedro Alves --- gdb/event-top.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'gdb/event-top.c') diff --git a/gdb/event-top.c b/gdb/event-top.c index 3686329..53ddd51 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -1209,7 +1209,15 @@ async_sigterm_handler (gdb_client_data arg) } /* See defs.h. */ -volatile int sync_quit_force_run; +volatile bool sync_quit_force_run; + +/* See defs.h. */ +void +set_force_quit_flag () +{ + sync_quit_force_run = true; + set_quit_flag (); +} /* Quit GDB if SIGTERM is received. GDB would quit anyway, but this way it will clean up properly. */ @@ -1218,8 +1226,7 @@ handle_sigterm (int sig) { signal (sig, handle_sigterm); - sync_quit_force_run = 1; - set_quit_flag (); + set_force_quit_flag (); mark_async_signal_handler (async_sigterm_token); } -- cgit v1.1