Re: (GLib) How to remove a Child Watch source that is not needed any more?

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

 



Hi again,

I use g_child_watch_source_new() to get notified when a spawned process exits. It works as expected, but if I ever need to stop taking care of it, this is, the parent process doesn't need to check if the child process is still being executed, I see that I cannot detach it from the main context properly with g_source_destroy(): the GSource still seems to be valid after that, and valgrind reports a FD leak for each Child Watch source that didn't get fired up when parent process exits.

So, is there a safe and clean way to remove those Child Watch sources from the main context?


I dug in the source code responsible for creating the Child Watch in GLib, and found that to implement the watch for the child process, GLib will eventually create a new thread performing a blocking read() in a pipe with the child process (child_watch_helper_thread).

Thus, even if we do the g_source_destroy() for that GSource to detach it from the main context, the thread will still be there stuck in the blocking read() in the pipe, at least until the child process exits.

Then the answer would be "no" to my question, right?

Cheers,
-Aleksander
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux