Re: GChildWatch source -- take two



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

> I don't know the internals of GMainLoop, but I think that if you pass
> NULL as the first argument in this call, new_main_loop will share the
> (default) GMainContext with the thread running in main.  For some
> reason, it's the thread running in main that is woken up to handle the
> events of this context.

Argh!  You and Owen are right.  I got the test case wrong.

> If I put something like
> 
>   GMainContext *context;
>   context = g_main_context_new ();
>   new_main_loop = g_main_loop_new (context, FALSE);
> 
> in its place, everything works.

That's much more encouraging to hear, then.  I'm much more confident in
the patch, now that that works.

> > That means that the thread should be alive when the child exits, and the
> > waitpid should be run from within that thread by the new_main_loop
> > within that thread.
> 
> The "thread exits before child" was just an example of a particularly
> nasty situation that is possible with LinuxThreads.

Right.  It's probably Okay to relegate that to the docs, though.

Thanks,
-Jonathan



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