|
From: Dave D. <dde...@es...> - 2006-07-31 09:14:33
|
Timoth=E9e Lecomte <tim...@en...> writes: > Dave Denholm wrote: >> >>> - mimic a 'bg' to gnuplot. Well, I don't know how to do that from >>> gnuplot, and I doubt it will actually work : since gnuplot's >>> process is still running, octave still waits for it. >>> >>> Do any of you have a miraculous idea, or should I report that to >>> the octave developers as I did for maxima ? >>> >>> >> >> gnuplot can fork(), then allow the parent to exit, leaving the child >> continuing to run the same code in exactly the same state, but >> detached. >> > This won't work in my case, because the terminal is multithreaded and > fork() has undetermined behaviour with threads, Not really... you can install fork handlers (assuming pthreads). But yes, it all becomes horribly complicated. See pthread_atfork() > and because exiting > the parent would close file and socket descriptors, thus closing the > connection to the X server. No, the child inherits the open files. > A workaround would be to close the GUI > thread and the windows before the fork() and to open them again in the > child, but I'm not sure maxima users would appreciate to see their > window disappearing and reappearing... > One other option would always be to immediately fork, but keep the parent around as a dummy process (just so that the original process knows it's still active). So all the work would happen in the child. In effect, code it as if you always detach, and then keep the parent alive as a workaround to stop the original process thinking the child has exited until the child chooses to detach. dd --=20 Dave Denholm <dde...@es...> http://www.esmertec= .com |