octave-maintainers
[Top][All Lists]
Advanced

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

Re: Ctrl-C & error handling


From: Jaroslav Hajek
Subject: Re: Ctrl-C & error handling
Date: Sun, 29 Mar 2009 21:39:11 +0200

On Sun, Mar 29, 2009 at 4:09 PM, Jaroslav Hajek <address@hidden> wrote:
> On Sun, Mar 29, 2009 at 3:39 PM, John W. Eaton <address@hidden> wrote:
>> On 29-Mar-2009, Jaroslav Hajek wrote:
>>
>> | is there any possibility for an m-function to implement a custom
>> | cleanup when Ctrl-C is detected? unwind_protect does not seem to catch
>> | Ctrl-C.
>> | The problem is that if a function manipulates system resources in a
>> | non-trivial manner, like parcellfun from the general package, it is
>> | not easy to manually clean up (parcellfun interrupted by Ctrl-C leaves
>> | hanging processes in the memory).
>>
>> The unwind-protect mechanism is intended to handle interrupts, so I
>> think it is a bug if somehow Ctrl-C jumps back to the top level
>> without evaluating the cleanup blocks.
>>
>
> OK, I hoped so. So the following simplistic script does not work:
>
> unwind_protect
>  pause(10);
> unwind_protect_cleanup
>  disp ("break");
> end_unwind_protect
>
> when I run it and press Ctrl-C, nothing is displayed.
>
>

I pushed the following change:
http://hg.savannah.gnu.org/hgweb/octave/rev/eabdfcc977f1

I'm not sure it is the right thing, but it seems to do what I want.
Should try/catch catch interrupts, too?

regards

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