Commit 06312387 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Initialize child_watch_count to 1, so that we don't miss the very first

2004-11-08  Matthias Clasen  <mclasen@redhat.com>

	* 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)
parent 6a1d7478
2004-11-08 Matthias Clasen <mclasen@redhat.com>
* 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 <mclasen@redhat.com>
* glib/gutils.c (g_get_any_init): Work around an bug
......
2004-11-08 Matthias Clasen <mclasen@redhat.com>
* 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 <mclasen@redhat.com>
* glib/gutils.c (g_get_any_init): Work around an bug
......
2004-11-08 Matthias Clasen <mclasen@redhat.com>
* 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 <mclasen@redhat.com>
* glib/gutils.c (g_get_any_init): Work around an bug
......
2004-11-08 Matthias Clasen <mclasen@redhat.com>
* 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 <mclasen@redhat.com>
* glib/gutils.c (g_get_any_init): Work around an bug
......
2004-11-08 Matthias Clasen <mclasen@redhat.com>
* 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 <mclasen@redhat.com>
* glib/gutils.c (g_get_any_init): Work around an bug
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment