mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-12 15:43:48 +02:00
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)
This commit is contained in:
parent
6a1d7478d7
commit
0631238743
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
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>
|
2004-11-07 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gutils.c (g_get_any_init): Work around an bug
|
* glib/gutils.c (g_get_any_init): Work around an bug
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
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>
|
2004-11-07 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gutils.c (g_get_any_init): Work around an bug
|
* glib/gutils.c (g_get_any_init): Work around an bug
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
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>
|
2004-11-07 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gutils.c (g_get_any_init): Work around an bug
|
* glib/gutils.c (g_get_any_init): Work around an bug
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
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>
|
2004-11-07 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gutils.c (g_get_any_init): Work around an bug
|
* glib/gutils.c (g_get_any_init): Work around an bug
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
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>
|
2004-11-07 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gutils.c (g_get_any_init): Work around an bug
|
* glib/gutils.c (g_get_any_init): Work around an bug
|
||||||
|
16
glib/gmain.c
16
glib/gmain.c
@ -266,7 +266,7 @@ enum {
|
|||||||
CHILD_WATCH_INITIALIZED_THREADED
|
CHILD_WATCH_INITIALIZED_THREADED
|
||||||
};
|
};
|
||||||
static gint child_watch_init_state = CHILD_WATCH_UNINITIALIZED;
|
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};
|
static gint child_watch_wake_up_pipe[2] = {0, 0};
|
||||||
#endif /* !G_OS_WIN32 */
|
#endif /* !G_OS_WIN32 */
|
||||||
G_LOCK_DEFINE_STATIC (main_context_list);
|
G_LOCK_DEFINE_STATIC (main_context_list);
|
||||||
@ -3566,12 +3566,17 @@ g_child_watch_signal_handler (int signum)
|
|||||||
static void
|
static void
|
||||||
g_child_watch_source_init_single (void)
|
g_child_watch_source_init_single (void)
|
||||||
{
|
{
|
||||||
|
struct sigaction action;
|
||||||
|
|
||||||
g_assert (! g_thread_supported());
|
g_assert (! g_thread_supported());
|
||||||
g_assert (child_watch_init_state == CHILD_WATCH_UNINITIALIZED);
|
g_assert (child_watch_init_state == CHILD_WATCH_UNINITIALIZED);
|
||||||
|
|
||||||
child_watch_init_state = CHILD_WATCH_INITIALIZED_SINGLE;
|
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
|
static gpointer
|
||||||
@ -3619,6 +3624,7 @@ static void
|
|||||||
g_child_watch_source_init_multi_threaded (void)
|
g_child_watch_source_init_multi_threaded (void)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
struct sigaction action;
|
||||||
|
|
||||||
g_assert (g_thread_supported());
|
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)
|
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);
|
g_error ("Cannot create a thread to monitor child exit status: %s\n", error->message);
|
||||||
child_watch_init_state = CHILD_WATCH_INITIALIZED_THREADED;
|
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
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user