[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Too much free time...
From: |
John W. Eaton |
Subject: |
Too much free time... |
Date: |
Mon, 26 Mar 2007 10:28:16 -0400 |
On 24-Mar-2007, Daniel J Sebald wrote:
| In trying to investigate why my system takes so long to draw, I placed a
pause()
| inside of __go_draw_axes__.m. I've tried pause in a simple test M file and
it
| seemed to work fine, but inside __go_draw_axes__.m according to the attached
| patch Octave goes into an infinite loop of redrawing the figure at a rapid
rate.
| After about twenty seconds I get:
|
| error: max_recursion_limit exceeded
|
| Any explanation for this? I wonder because this might be a clue to the
source
| of delay in my system. That is, without the "pause()" perhaps (just
guessing)
| there is this loop that goes to the recursion limit, stops then draws the
plot.
| With the pause(), the loop "comes back to the command line" and draws every
| time, hence it takes longer to reach the recursion limit.
|
| I can't see any files in octave subdirectory left over from the plotting
| debugging that might cause this.
As you found, pause calls drawnow. I think the following patch would
avoid the problem, but I'm not sure it is really necessary.
jwe
2007-03-26 John W. Eaton <address@hidden>
* plot/drawnow.m: Exit early if call is recursive.
Index: scripts/plot/drawnow.m
===================================================================
RCS file: /cvs/octave/scripts/plot/drawnow.m,v
retrieving revision 1.14
diff -u -u -w -r1.14 drawnow.m
--- scripts/plot/drawnow.m 24 Mar 2007 17:54:23 -0000 1.14
+++ scripts/plot/drawnow.m 26 Mar 2007 14:25:50 -0000
@@ -26,6 +26,15 @@
function drawnow (term, file)
+ persistent drawnow_executing = 0;
+
+ unwind_protect
+
+ ## If this is a recursive call, do nothing.
+ if (++drawnow_executing > 1)
+ return;
+ endif
+
if (nargin == 2)
h = get (0, "currentfigure");
if (h)
@@ -60,15 +69,19 @@
endif
set (h, "__modified__", false);
endif
- __request_drawnow__ (false);
endif
endfor
else
print_usage ();
endif
+ unwind_protect_cleanup
+
+ drawnow_executing--;
__request_drawnow__ (false);
+ end_unwind_protect
+
endfunction
function plot_stream = open_gnuplot_stream (h, term, file)