[tracker/sam/signal-handling: 2/2] Processes shouldn't install the signal handler until the main loop starts
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/sam/signal-handling: 2/2] Processes shouldn't install the signal handler until the main loop starts
- Date: Fri, 1 Aug 2014 21:49:25 +0000 (UTC)
commit 4ab254d9d83c8571ec2612159bec6495b5adbfb1
Author: Sam Thursfield <sam afuera me uk>
Date: Thu Jul 31 13:57:20 2014 +0100
Processes shouldn't install the signal handler until the main loop starts
The signal handler we install calls g_main_loop_quit() when SIGTERM or SIGINT
are raised, but this is only useful if the loop was started. Sending SIGTERM or
SIGINT to a Tracker process while it is starting up fails to stop the process,
and triggers the following a warning:
GLib-CRITICAL **: g_main_loop_quit: assertion 'loop != NULL' failed
Ideally we'd call initialize_signal_handler from an idle once the main
loop has started, but installing it just before the loop starts should
be a big improvement.
https://bugzilla.gnome.org/show_bug.cgi?id=734144
src/miners/apps/tracker-main.c | 4 ++--
src/miners/fs/tracker-main.c | 4 ++--
src/miners/user-guides/tracker-main.c | 4 ++--
src/tracker-extract/tracker-main.c | 4 ++--
src/tracker-store/tracker-main.vala | 4 ++--
5 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/miners/apps/tracker-main.c b/src/miners/apps/tracker-main.c
index caef883..d3f42a9 100644
--- a/src/miners/apps/tracker-main.c
+++ b/src/miners/apps/tracker-main.c
@@ -206,8 +206,6 @@ main (gint argc, gchar *argv[])
return EXIT_SUCCESS;
}
- initialize_signal_handler ();
-
tracker_log_init (verbosity, &log_filename);
if (log_filename) {
g_message ("Using log file:'%s'", log_filename);
@@ -237,6 +235,8 @@ main (gint argc, gchar *argv[])
G_CALLBACK (miner_finished_cb),
NULL);
+ initialize_signal_handler ();
+
/* Go, go, go! */
tracker_miner_start (miner_applications);
g_main_loop_run (main_loop);
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 2fc0d8e..a2ea8f4 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -730,8 +730,6 @@ main (gint argc, gchar *argv[])
return EXIT_SUCCESS;
}
- initialize_signal_handler ();
-
/* Initialize logging */
config = tracker_config_new ();
@@ -837,6 +835,8 @@ main (gint argc, gchar *argv[])
miner_handle_first (config, do_mtime_checking);
+ initialize_signal_handler ();
+
/* Go, go, go! */
g_main_loop_run (main_loop);
diff --git a/src/miners/user-guides/tracker-main.c b/src/miners/user-guides/tracker-main.c
index 4f51c24..b264f9f 100644
--- a/src/miners/user-guides/tracker-main.c
+++ b/src/miners/user-guides/tracker-main.c
@@ -172,6 +172,8 @@ miner_start_cb (gpointer user_data)
{
TrackerMiner *miner = user_data;
+ initialize_signal_handler ();
+
tracker_miner_start (miner);
return FALSE;
@@ -216,8 +218,6 @@ main (gint argc, gchar *argv[])
return EXIT_SUCCESS;
}
- initialize_signal_handler ();
-
tracker_log_init (verbosity, &log_filename);
if (log_filename) {
g_message ("Using log file:'%s'", log_filename);
diff --git a/src/tracker-extract/tracker-main.c b/src/tracker-extract/tracker-main.c
index 30b7578..f7e3e55 100644
--- a/src/tracker-extract/tracker-main.c
+++ b/src/tracker-extract/tracker-main.c
@@ -334,8 +334,6 @@ main (int argc, char *argv[])
return EXIT_SUCCESS;
}
- initialize_signal_handler ();
-
g_set_application_name ("tracker-extract");
setlocale (LC_ALL, "");
@@ -395,6 +393,8 @@ main (int argc, char *argv[])
controller = tracker_extract_controller_new (decorator);
tracker_miner_start (TRACKER_MINER (decorator));
+ initialize_signal_handler ();
+
/* Main loop */
main_loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (main_loop);
diff --git a/src/tracker-store/tracker-main.vala b/src/tracker-store/tracker-main.vala
index d121f13..7d61131 100644
--- a/src/tracker-store/tracker-main.vala
+++ b/src/tracker-store/tracker-main.vala
@@ -184,8 +184,6 @@ License which can be viewed at:
return 0;
}
- initialize_signal_handler ();
-
/* This makes sure we don't steal all the system's resources */
initialize_priority ();
@@ -303,6 +301,8 @@ License which can be viewed at:
* doing what they do and shutdown.
*/
if (!shutdown) {
+ initialize_signal_handler ();
+
main_loop = new MainLoop ();
main_loop.run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]