From: <tim...@en...> - 2006-07-25 17:24:39
|
Hi, I am working on the bug #1527701, and I need some advice. The bug comes from the current implementation of "persist" in the wxt=20 terminal. This option is used by external programs, like maxima, to control=20 gnuplot. They send their commands through a pipe or a file or whatever,=20 they let gnuplot exit at the end of the commands, but as they want the=20 plot windows to stay open, they use "persist". The X11 terminal lives in a separate process, so for this terminal the=20 "persist" option makes gnuplot main process to exit while the=20 gnuplot_x11 stays alive until the user closes all the windows. However, the wxt terminal is not a separate process. It lives in gnuplot=20 main executable, so when gnuplot exits the plot windows can't but be=20 closed. That's why I implemented "persist" so that gnuplot won't exit=20 until all wxWidgets windows are closed. But obviously that's not what=20 maxima (and probably others, I have not tried octave) wants. I thought=20 about using fork() to duplicate the process, then close the parent=20 process so that maxima and friends will be happy, and let the child=20 process take care of the windows. Although it sounds nice, it is=20 actually dangerous as 1) fork() is not portable, 2) there are a bunch of=20 undetermined behaviours when using fork() in a multithreaded application=20 (the wxWidgets main loop lives in a separate thread, so gnuplot is=20 multithreaded in this context) or an application using X. I'm stuck. Do you have any idea to implement "persist" in this context ? Best regards, Timoth=C3=A9e P.S. : I tend to think that "persist" was a bad idea in the first place=20 : why wouldn't maxima simply leave gnuplot alone and continue its work ?=20 But I don't want to break any established behaviour either... |