[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 16:09:09 +0200 |
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.
--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz