Re: gtk3 and fork/exec of non-gtk child




Hi Emmanuele,

On closer reading there are some details of GSubProcess implementation and usage that are unclear to me. I have not been able to find anything resembling a tutorial anywhere, if you are aware of anything useful other than the base GSubProcess reference manual page please advise. Or, if there is a better forum to ask these questions, also please advise.

Here's what is still unclear to me about the suitability of GSubProcess for my code:

(1) Is there a ROCK-SOLID guarantee that the death of all child processes will be reported one-for-one with GSubProcess? My understanding of fork/exec/SIGCHLDhandler is that it is possible for there to be only one SIGCHLD made pending on a process even if multiple children have exited. This is dealt with by having the SIGCHLDhandler implement a loop which is capable of waitpid()ing on multiple children. How does GSubProcess cope with this issue? Is SIGCHLD even used at all, or is there a hidden SIGCHLDhandler somewhere that does waitpid()-ish looping? My app absolutely must know when each and every child dies (within a reasonable latency) or it's worthless.

(2) I see a g_subprocess_new() but no corresponding g_subprocess_destroy(). I will potentially have many children exiting and restarting and would prefer not to burn through the heap with scads of expired useless GSubProcess objects. I am not at all familiar with glib/gobject/gio in general, so I assume I am missing something totally obvious here.

(3) The GSubProcess doc page does not explicitly state this, but I get the impression from reading related pages (GAsyncResult) that the handler I register with g_subprocess_wait_async() is required to call g_subprocess_wait_finish(). Is this true?

Thanks!

Roger


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