After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 170002 - add a SignalChildWatch class
add a SignalChildWatch class
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2005-03-11 20:45 UTC by Yair Hershkovitz
Modified: 2005-03-14 15:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (4.65 KB, patch)
2005-03-11 20:46 UTC, Yair Hershkovitz
none Details | Review
better patch (6.38 KB, patch)
2005-03-13 21:39 UTC, Yair Hershkovitz
none Details | Review
child watch example (1.12 KB, application/x-compressed-tar)
2005-03-13 21:41 UTC, Yair Hershkovitz
  Details

Description Yair Hershkovitz 2005-03-11 20:45:16 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)
Comment 1 Yair Hershkovitz 2005-03-11 20:46:54 UTC
Created attachment 38572 [details] [review]
patch

.
Comment 2 Murray Cumming 2005-03-12 10:26:09 UTC
This looks really good. Could you add an example for it too?
Comment 3 Yair Hershkovitz 2005-03-12 16:01:53 UTC
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);
Comment 4 Murray Cumming 2005-03-13 10:55:10 UTC
I mean a full example in the examples directory. I guess it would start a
process and wait for it to finish.
Comment 5 Yair Hershkovitz 2005-03-13 21:39:46 UTC
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
Comment 6 Yair Hershkovitz 2005-03-13 21:41:17 UTC
Created attachment 38658 [details]
child watch example

.
Comment 7 Murray Cumming 2005-03-14 15:22:19 UTC
Wonderful. Committed to HEAD, with just some small whitespace changes to the
example, to make it match the existing style. Thanks.