g_child_watch usage
- From: "Nickolay V. Shmyrev" <nshmyrev yandex ru>
- To: gtk-devel-list gnome org
- Subject: g_child_watch usage
- Date: Thu, 13 May 2004 00:32:59 +0400
Hello. I develop application that can manage child process with ptrace/
gtk. It runs child process in vte terminal using vte_terminal_forkpty
and manages it's with ptrace calls.
For notification about child state I've used VteReaper implementation
(it is similar to g_child_watch, it is GObject, that emits signal on
child exit). To implement it, vte used sigaction. Now vte is upgraded to
0.11.11 and use g_child_watch functionality to implement VteReaper. And
I've meet some problems, because of difference of old implementation of
reaper and new.
The problem is that after first SIGCLD the g_child_source is removed
automatically and can't be longer used. To solve this problem, I suggest
the following change:
--- gmain.c.orig Sun Mar 14 20:58:27 2004
+++ gmain.c Wed May 12 19:09:16 2004
@@ -3489,6 +3489,15 @@
(child_watch_callback) (child_watch_source->pid, child_watch_source-
>child_status, user_data);
+#ifndef G_OS_WIN32
+ /* If child have not exit yet, we should wait for for another
SIGCHILD */
+ if (!WIFEXITED(child_watch_source->child_status))
+ {
+ child_watch_source->child_exited = FALSE;
+ return TRUE;
+ }
+#endif
+
/* We never keep a child watch source around as the child is gone */
return FALSE;
}
Is there another solution for that problem?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]