All pastes #1699427 Raw Edit

Miscellany

public text v1 · immutable
#1699427 ·published 2009-12-03 01:39 UTC
rendered paste body
diff --git a/src/main.c b/src/main.c
index 3b95e15..dcc7790 100644
--- a/src/main.c
+++ b/src/main.c
@@ -36,7 +36,7 @@
 #define SHUTDOWN_GRACE_SECONDS 10
 
 static GMainLoop *event_loop;
-static guint quit_eventloop_source = 0;
+static volatile sig_atomic_t terminated = 0;
 
 void __ofono_exit()
 {
@@ -56,11 +56,11 @@ static void sig_debug(int sig)
 
 static void sig_term(int sig)
 {
-	if (quit_eventloop_source != 0)
+	if (terminated > 0)
 		return;
 
-	quit_eventloop_source = g_timeout_add_seconds(SHUTDOWN_GRACE_SECONDS,
-							quit_eventloop, NULL);
+	terminated++;
+	g_timeout_add_seconds(SHUTDOWN_GRACE_SECONDS, quit_eventloop, NULL);
 	__ofono_modem_shutdown();
 }