GNOME Bugzilla – Bug 170002
add a SignalChildWatch class
Last modified: 2005-03-14 15:22:19 UTC
i've noticed that there was no implementation for glib's child_watch events, so i've made one using a SignalChildWatch class. i didn't make a ChildWatchSource class because i saw that the glib's implementation is somewhat complex (perhaps un-necessarily?). i'm not sure why it isn't enough to check waitpid(pid,NULL,WNOHANG)
Created attachment 38572 [details] [review] patch .
This looks really good. Could you add an example for it too?
i'm not sure what you mean. how to use example? void child(GPid pid,int status) { cout<<"child "<<pid<<exited"<<endl; } Glib::signal_child_watch().connect(sigc::ptr_fun(&child),pid);
I mean a full example in the examples directory. I guess it would start a process and wait for it to finish.
Created attachment 38657 [details] [review] better patch example was added. MainContext::signal_child_watch() was added. i've also patched configure.in and examples/Makefile.am to compile the example this patch completly replaces the previous one NOTE: the actual example directory is in another attachment
Created attachment 38658 [details] child watch example .
Wonderful. Committed to HEAD, with just some small whitespace changes to the example, to make it match the existing style. Thanks.