octave-maintainers
[Top][All Lists]
Advanced

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

Re: Patch to Octave shutdown procedures


From: Jaroslav Hajek
Subject: Re: Patch to Octave shutdown procedures
Date: Tue, 19 May 2009 16:25:58 +0200

On Mon, May 18, 2009 at 9:27 PM, John Swensen <address@hidden> wrote:
> As I have been working on OctaveDE, I have found that the way Octave
> currently shuts down has made me jump through hoops to get the shutdown
> sequence right.  Because the clean_up_and_exit() function directly calls
> exit() and because I am interacting with octave via a different thread, I
> have had serious issues with variables becoming invalid in the middle of an
> operation.  I propose the following patch (or something similar) to allow an
> IDE to clean up Octave on its own.  The patch simply provides two additional
> flags:
> 1) ide_embedded: allows a user to flag and instance of octave as being
> embedded in an IDE.  This flags makes it so clean_up_and_exit only sets the
> do_exit_readline_loop flag
> 2) do_exit_readline_loop: this flags causes the main_loop which calls
> readline to exit and do nothing else
>
> Then, in my IDE, after I have stopped all the threads that are interacting
> with Octave and am sure that the readline idle event loop is also no longer
> running, I call do_octave_atexit() myself to clean things up.  Maybe you
> would like a different format or manner of handling this, but at this point
> it is somewhat of a necessity for me to create a robust IDE using VTE in
> which the Octave process is simply embedded in a terminal window in my
> application.  I have spent a lot of time trying workarounds and the only
> other viable option it to issue a full KILL signal to Octave running in VTE,
> which seems ugly and unnecessary and doesn't work for Windows.  This patch
> would work for both Windows, Linux, and OSX.
>
> John Swensen
>

I'm not sure I understand the problem. Can't you just send "end of
input" to the embedded Octave to make it exit from main_loop? The
thread running Octave can then signal to other threads that main_loop
ended in whatever manner you need, so you can synchronize, and then
call do_octave_atexit and sysdep_cleanup. Maybe it would be nice to
have a cleanup_only variant of cleanup_and_exit.

cheers

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]