[Bug 136867] - child-test is still hanging



http://bugzilla.gnome.org/show_bug.cgi?id=136867
glib | general | Ver: 2.3.x





------- Additional Comments From archana shah wipro com  2004-08-04 01:33 -------
This is happening on Solaris also. There gnome-terminal does not exit because
SIGCHLD is emitted only once. So only one window gets closed when we say 'exit'
and rest all just hang. We can have two solutions for this, either of them fixes
this bug.

One solution is to use sigaction instead of signal. 
Here is the change:

 g_child_watch_source_init_multi_threaded (void)
 {
   GError *error = NULL;
+  struct sigaction action;

   g_assert (g_thread_supported());

@@ -3630,7 +3631,10 @@ g_child_watch_source_init_multi_threaded
   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);
 }


Other solution is to re-install signal every time it is caught. For this the
change that has to be mads is :

@@ -3551,6 +3551,8 @@ g_child_watch_signal_handler (int signum
 {
   child_watch_count ++;

+  signal (SIGCHLD, g_child_watch_signal_handler);
+
   if (child_watch_init_state == CHILD_WATCH_INITIALIZED_THREADED)
     {
       write (child_watch_wake_up_pipe[1], "B", 1);


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]