Re: GChildWatch source -- take two



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

> Same problem: the thread that calls waitpid is the one that runs in the
> function main, and because of bugs in LinuxThreads it can't wait for the
> children of the other threads.

Looking again, that analysis doesn't make sense.  We run the following
code in a thread:

  ...
  new_main_loop = g_main_loop_new (NULL, FALSE);
  pid = get_a_child ();
  source = g_child_watch_source_new (pid);
  g_source_set_callback (source, (GSourceFunc) child_watch_callback,  NULL, NULL);
  g_source_attach (source, g_main_loop_get_context (new_main_loop));
  g_source_unref (source);
  g_main_loop_run (new_main_loop);
  ...

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.

Strange...
-Jonathan




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