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



On 2017-01-14 01:51 PM, Eric Cashon via gtk-app-devel-list wrote:
Hi Roger,

A little while back I was testing something similar with g_spawn_async_with_pipes(). It is neither 
mission-critical or meticulous but something I was just testing for the possible use with gnuplot. There is a 
driver.c and a worker.c program. The driver spawns the worker and sets up some communication. You just need 
to set the location path of the worker in driver.c. Sort of simple but I had some trouble figuring out how 
some of this worked so... it might be helpful.

https://github.com/cecashon/OrderedSetVelociRaptor/tree/master/Misc/Pipes

I haven't used GSubprocess and don't know of a short starter there.

Eric


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

I too have used g_spawn_async_with_pipes() and GIOChannel's to spawn child processes that monitor USB temperature probes and pipe the data back to a main program. For me it was important that the children were asynchronous and independent. The child processes have no GUI or direct user interaction (except through the main program). I have no problem spawning multiple child processes (for multiple probes) and can easily stop them at will by sending them a signal along the pipe to close them down. The code is very similar to Eric's, albeit buried in a much larger program.

I haven't used GSubprocess either but in looking at it, it looks pretty interesting.

jim...



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