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 17:00:01 +0200

On Tue, May 19, 2009 at 4:45 PM, John Swensen <address@hidden> wrote:
>
> On May 19, 2009, at 10:25 AM, Jaroslav Hajek wrote:
>
>> On Mon, May 18, 2009 at 9:27 PM, John Swensen <address@hidden>
>> wrote:
>>
>> 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
>>
>> --
>
> Having a cleanup_only variant of cleanup_and_exit was kindof what I was
> trying to do.  However, it is not enough just to have the cleanup_only
> variant, we need to allow a developer to set a flag which indicates this
> should be used in place of cleanup_and_exit.  Also, I don't really want to
> "cleanup" when an exit-Octave condition occurs, I simply want the Octave
> readline loop to end, then clean up all the IDE stuff that is interacting
> with octave, then cleanup Octave.  The biggest problem occurs when a user
> calls 'exit' or does a CTRL-C until Octave exits.  In this instance, exit()
> gets called before I have any indication that Octave is closing.  This means
> that the threads I have which monitor Octave continue to do so, even though
> all of Octave has been cleaned up.
>
> My patch attempted to allow an IDE to instantiate octave by calling
> octave_main such that:
> 1) Any condition which would cause octave to call the libc function exit()
> (e.g. exit, CTRL-C, others) simply cause octave_main() to return
> 2) do_octave_atexit() would not be called before octave_main() returns
>
> If you can think of a better way of doing this, then I will try to implement
> it.  Your suggestion of sending an "end of input" to exit from the main_loop
> doesn't quite work for 2 reasons.  First, if you look at the source code for
> the octave_main function in octave.cc, if main_loop returns then
> clean_up_and_exit() is called.   Second, if you look at the definition of
> 'quit' in toplev.cc and the signal handlers in sighandlers.cc you will see
> that clean_up_and_exit() is called from these without the main_loop ever
> returning.
>

Aren't you calling octave_main with the embedded flag? If not, why?


-- 
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]