octave-maintainers
[Top][All Lists]
Advanced

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

Re: Quick tutorial on OCTAVE_QUIT


From: David Bateman
Subject: Re: Quick tutorial on OCTAVE_QUIT
Date: Mon, 19 Mar 2007 11:09:20 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

John Swensen wrote:
> I have been writing a DLD function to take images from a firewire
> camera, but have been having a problem that anytime I hit CTRL-C while
> inside on the the DLD functions in my OCT file, then all of octave
> crashes.  I went and had a look at a bunch of the DLD functions that
> come with Octave and saw that they are littered with the macro call
> OCTAVE_QUIT.  I tried to dig around in the mailing lists and got a
> vague idea that it allows clean exit from DLD functions when an
> interrupt is encountered, but could someone give a little more
> detailed explanation of what it does and where it should be used?
>
> John Swensen
>
OCTAVE_QUIT is a macro that uses the C++ exception handler to jump out
of a loop and back to the prompt when crtl-c is pressed, while still
de-allocating memory correctly if it was allocated in C++. There is an
important exception to this for foriegn code that is not in C++. They
won't clean-up correctly. For example it is typical to use

     BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
     ... some code that calls a "foreign" function ...
     END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;

around an external fortran or C code. However, if that code allocates
memory internally, it won't be deallocated..

D.


-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

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