From: <tim...@lp...> - 2007-12-23 14:13:34
|
Ethan A Merritt a écrit : > On Saturday 22 December 2007 13:41, Timothée Lecomte wrote: > >> When the user hits ctrl-c, the SIGINT handler is supposed to be run >> immediately, interrupting any operation running at that time. So I would >> have expected communication errors because fprintf()'s used in x11.trm >> can be interrupted before they finish, but I don't see any such error. >> > > Two answers: > > Each write into the pipe from gnuplot to gnuplot_x11 is a unit. > If you interrupt the process before it is sent, then nothing is sent. > If you interrupt during/after it is sent, then so far as I know the > entire write completes. I don't think you can cause a partial write > to a pipe by sending a signal to the task that does the writing. > > It's what my tests tend to prove, but nowhere in the docs it is said to behave that way. On the contrary, 'man 2 read' and 'man 2 write' explicitly say that a read or a write can be interrupted by a signal and then they won't have written or read all the bytes. > You might be worried that the plot itself is incomplete, even though > the individual write operations complete normally. But this doesn't matter. > There is an explicit end-of-plot command sent over the pipe consisting > of the single character 'E'. This is sent by X11_text(). > Until it receives that 'E', gnuplot_x11 just accummulates commands > into a new plot structure. If the 'E' is not received, then it will > never try to display the plot. So it doesn't matter that it is incomplete. > > Ethan > That part I don't understand too. In practice, when doing 'set samples 10000; set isosamples 10000; splot x**2*y**2 with pm3d;' and interrupting the process with ctrl-c, I sometime got a partly rendered plot, whereas the 'E' obviously wasn't sent yet. I'm lost. Best regards, Timothée Lecomte |