1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-03 20:48:31 +00:00

Gracefully exit from main_loop()

Signed-off-by: Nikos Ntarmos <ntarmos@cs.uoi.gr>
Signed-off-by: Brenden Matthews <brenden@rty.ca>
This commit is contained in:
Nikos Ntarmos 2009-05-28 16:50:19 +03:00 committed by Brenden Matthews
parent c03655bdfa
commit b51d06d178

View File

@ -6479,6 +6479,7 @@ int inotify_fd;
static void main_loop(void) static void main_loop(void)
{ {
int terminate = 0;
#ifdef SIGNAL_BLOCKING #ifdef SIGNAL_BLOCKING
sigset_t newmask, oldmask; sigset_t newmask, oldmask;
#endif #endif
@ -6500,7 +6501,7 @@ static void main_loop(void)
next_update_time = last_update_time = get_time(); next_update_time = last_update_time = get_time();
info.looped = 0; info.looped = 0;
while (total_run_times == 0 || info.looped < total_run_times) { while (terminate == 0 && (total_run_times == 0 || info.looped < total_run_times)) {
info.looped++; info.looped++;
#ifdef SIGNAL_BLOCKING #ifdef SIGNAL_BLOCKING
@ -6776,6 +6777,7 @@ static void main_loop(void)
case SIGINT: case SIGINT:
case SIGTERM: case SIGTERM:
ERR("received SIGINT or SIGTERM to terminate. bye!"); ERR("received SIGINT or SIGTERM to terminate. bye!");
terminate = 1;
clean_up(); clean_up();
#ifdef X11 #ifdef X11
if (output_methods & TO_X) { if (output_methods & TO_X) {
@ -6798,8 +6800,7 @@ static void main_loop(void)
free(append_file); free(append_file);
append_file = 0; append_file = 0;
} }
return; /* return from main_loop */ break;
/* break; */
default: default:
/* Reaching here means someone set a signal /* Reaching here means someone set a signal
* (SIGXXXX, signal_handler), but didn't write any code * (SIGXXXX, signal_handler), but didn't write any code