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: Wed, 20 May 2009 10:06:52 +0200

On Wed, May 20, 2009 at 7:31 AM, Jaroslav Hajek <address@hidden> wrote:
> On Wed, May 20, 2009 at 5:58 AM, John Swensen <address@hidden> wrote:
>>
>> On May 19, 2009, at 3:56 PM, Jaroslav Hajek wrote:
>>
>>> On Tue, May 19, 2009 at 9:36 PM, John Swensen <address@hidden>
>>> wrote:
>>>>
>>>> On May 19, 2009, at 3:21 PM, Jaroslav Hajek wrote:
>>>>>
>>>>> But why don't you call octave_main with embedded = true and just call
>>>>> main_loop afterwards?
>>>>>
>>>>> octave_main (argc, argv, true);
>>>>>
>>>>> // possibly call install_signal_handlers () and adjust the handlers
>>>>>
>>>>> main_loop ();
>>>>>
>>>>> // cleanup
>>>>> do_octave_atexit ();
>>>>> sysdep_cleanup ();
>>>>>
>>>>> what's the problem with this scheme?
>>>>>
>>>>>
>>>>
>>>> I think there are 2 problem with this approach:
>>>> 1) That still doesn't solve the problem of the Octave quit function and
>>>> the
>>>> signal handlers calling exit().  I suppose I could replace all the Octave
>>>> signal handlers with my own, but that seems like just asking for trouble
>>>> and
>>>> would still have the problem with the Octave quit function.
>>>
>>> I think your approach solves the problem with signal handlers neither.
>>> quit() is a real trouble.
>>> Maybe it'd be best if there was an octave_exit function pointer, that
>>> could be replaced?
>>> In all places where we call exit() now, we'd just just call
>>> (*octave_exit)().
>>>
>>
>> The patch I submitted does solve the problem with the Octave quit function
>> by bypassing the call to exit().  However, I do like the idea of creating an
>> octave_exit() function that could be replaced.  I will work on a patch along
>> these lines.
>>
>
> I can do it. This issue affects other projects I'm interested in, too.
> There should really be a clean way to prevent quit() from terminating
> the whole process if Octave is embedded. It never occured to me before
> :)
>

I committed the following patch:
http://hg.savannah.gnu.org/hgweb/octave/rev/ee7cf4d963f3

summary:
quit() now raises an octave_quit_exception, carrying the exit status.
this is handled in main_loop and a couple of other functions.
octave_exit pointer is declared and points to ::exit at startup. it
may be overriden by user code or even NULL.

also, main_loop et al. now perform unwind_protect_cleanup actions when
quit() is called. It seems reasonable to do so - anyone disagrees?

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]