diff --git a/ChangeLog b/ChangeLog index ead6b15ed..07ce92a54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2004-11-08 Matthias Clasen + + * glib/gmain.c: Initialize child_watch_count to 1, so + that we don't miss the very first child if it exits + before we set up the child watch. In that case we had + previously source->count == child_watch_count == 0, + causing g_child_watch_check() to skip the waitpid() + call. (#154827, Gustavo Carneiro) + + * glib/gmain.c (g_child_watch_source_init_single) + (g_child_watch_source_init_multi_threaded): Use sigaction() + instead of signal(). (#136867, Jonas Jonsson, patch by + Archana Shah) + 2004-11-07 Matthias Clasen * glib/gutils.c (g_get_any_init): Work around an bug diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ead6b15ed..07ce92a54 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,17 @@ +2004-11-08 Matthias Clasen + + * glib/gmain.c: Initialize child_watch_count to 1, so + that we don't miss the very first child if it exits + before we set up the child watch. In that case we had + previously source->count == child_watch_count == 0, + causing g_child_watch_check() to skip the waitpid() + call. (#154827, Gustavo Carneiro) + + * glib/gmain.c (g_child_watch_source_init_single) + (g_child_watch_source_init_multi_threaded): Use sigaction() + instead of signal(). (#136867, Jonas Jonsson, patch by + Archana Shah) + 2004-11-07 Matthias Clasen * glib/gutils.c (g_get_any_init): Work around an bug diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index ead6b15ed..07ce92a54 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,17 @@ +2004-11-08 Matthias Clasen + + * glib/gmain.c: Initialize child_watch_count to 1, so + that we don't miss the very first child if it exits + before we set up the child watch. In that case we had + previously source->count == child_watch_count == 0, + causing g_child_watch_check() to skip the waitpid() + call. (#154827, Gustavo Carneiro) + + * glib/gmain.c (g_child_watch_source_init_single) + (g_child_watch_source_init_multi_threaded): Use sigaction() + instead of signal(). (#136867, Jonas Jonsson, patch by + Archana Shah) + 2004-11-07 Matthias Clasen * glib/gutils.c (g_get_any_init): Work around an bug diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index ead6b15ed..07ce92a54 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,17 @@ +2004-11-08 Matthias Clasen + + * glib/gmain.c: Initialize child_watch_count to 1, so + that we don't miss the very first child if it exits + before we set up the child watch. In that case we had + previously source->count == child_watch_count == 0, + causing g_child_watch_check() to skip the waitpid() + call. (#154827, Gustavo Carneiro) + + * glib/gmain.c (g_child_watch_source_init_single) + (g_child_watch_source_init_multi_threaded): Use sigaction() + instead of signal(). (#136867, Jonas Jonsson, patch by + Archana Shah) + 2004-11-07 Matthias Clasen * glib/gutils.c (g_get_any_init): Work around an bug diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ead6b15ed..07ce92a54 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,17 @@ +2004-11-08 Matthias Clasen + + * glib/gmain.c: Initialize child_watch_count to 1, so + that we don't miss the very first child if it exits + before we set up the child watch. In that case we had + previously source->count == child_watch_count == 0, + causing g_child_watch_check() to skip the waitpid() + call. (#154827, Gustavo Carneiro) + + * glib/gmain.c (g_child_watch_source_init_single) + (g_child_watch_source_init_multi_threaded): Use sigaction() + instead of signal(). (#136867, Jonas Jonsson, patch by + Archana Shah) + 2004-11-07 Matthias Clasen * glib/gutils.c (g_get_any_init): Work around an bug diff --git a/glib/gmain.c b/glib/gmain.c index 9fb7d5ef5..c522aba24 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -266,7 +266,7 @@ enum { CHILD_WATCH_INITIALIZED_THREADED }; static gint child_watch_init_state = CHILD_WATCH_UNINITIALIZED; -static gint child_watch_count = 0; +static gint child_watch_count = 1; static gint child_watch_wake_up_pipe[2] = {0, 0}; #endif /* !G_OS_WIN32 */ G_LOCK_DEFINE_STATIC (main_context_list); @@ -3566,12 +3566,17 @@ g_child_watch_signal_handler (int signum) static void g_child_watch_source_init_single (void) { + struct sigaction action; + g_assert (! g_thread_supported()); g_assert (child_watch_init_state == CHILD_WATCH_UNINITIALIZED); child_watch_init_state = CHILD_WATCH_INITIALIZED_SINGLE; - signal (SIGCHLD, g_child_watch_signal_handler); + action.sa_handler = g_child_watch_signal_handler; + sigemptyset (&action.sa_mask); + action.sa_flags = SA_RESTART | SA_NOCLDSTOP; + sigaction (SIGCHLD, &action, NULL); } static gpointer @@ -3619,6 +3624,7 @@ static void g_child_watch_source_init_multi_threaded (void) { GError *error = NULL; + struct sigaction action; g_assert (g_thread_supported()); @@ -3631,7 +3637,11 @@ g_child_watch_source_init_multi_threaded (void) if (g_thread_create (child_watch_helper_thread, NULL, FALSE, &error) == NULL) g_error ("Cannot create a thread to monitor child exit status: %s\n", error->message); child_watch_init_state = CHILD_WATCH_INITIALIZED_THREADED; - signal (SIGCHLD, g_child_watch_signal_handler); + + action.sa_handler = g_child_watch_signal_handler; + sigemptyset (&action.sa_mask); + action.sa_flags = SA_RESTART | SA_NOCLDSTOP; + sigaction (SIGCHLD, &action, NULL); } static void