Re: GChildWatch source -- take two



"Alexis S. L. Carvalho" <alexis cecm usp br> writes:

> Thus spake Jonathan Blandford:
> > No, I meant to have g_child_watch_add(-1) have the same effect as
> > calling waitpid(-1).  That is to say, it'll give notice of every child
> > process that exits.  g_child_watch_add(0) will give notice of children
> > in the process group, just as waitpid(0) does.  With this behavior, it
> > makes more sense to check the return value of the call.
> 
> This feature might be useful, but there are some points that would be
> difficult to implement (or would require quite a few modifications in
> the patch):

> I'd say to leave this out for now and see if somebody complains - you
> may have to check that pid > 0 in g_child_watch_source_new, to guarantee
> that nobody tries to use this behind GLib.

I was thinking that you can call watch_add(-1), watch_add(0), or
multiple calls watch_add(>0).  That defeats the purpose of this call,
though.  It's intended to let different libraries that may not know
about each other watch for child-processes exiting.  You might be right
-- calling waitpid(-1) every time could solve some of these problems..
I'm not sure if I have time and energy right now to refactor the code to
do this.

> Also, with the current implementation, if you register two sources for
> the same pid, only one will be called - the docs should probably mention
> that.

"user error".  Will add to the docs.  Presumably, if you have the pid
you know if you added the watch.

Are we getting closer to something that can be committed?
-Jonathan



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