octave-maintainers
[Top][All Lists]
Advanced

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

Re: Special code for handling interrupts on Windows systems


From: Michael Goffioul
Subject: Re: Special code for handling interrupts on Windows systems
Date: Tue, 7 May 2013 11:37:45 -0400

On Tue, Apr 30, 2013 at 9:42 AM, PhilipNienhuis <address@hidden> wrote:
Michael Goffioul wrote
> :
> <long snip>
> :
> From what I could test, interrupting octave seems to work reliably.
> However, using CTRL-C when it's idle kills octave (in GUI or CLI mode).
> This is for my MSVC-compiled version.

FWIW, on my WinXP, typing Ctrl-C in the terminal when idle consistently
kills MSVC Octave builds but not the MinGW Octave builds (both MXE
cross-compiled and "natively" built). So I suppose this behavior (killing
Octave when idle) is a typical MSVC thing.

Some time ago I reported this in a thread in either the bug tracker or the
maintainers list but I can't find that posting right now :-(

After some debugging, it appears the problem is due to Win32 handling CTRL-C signal handler in a separate thread. When octave is idle, then octave_interrupt_exception is thrown from that separate thread. But it is not caught in the main thread (as in: throwing exceptions across threads does not work). This does not happen when octave is not idle, because in that case, the SIGINT handler will just increase an internal variable, and this will then be caught later in the main thread (with octave_quit); hence the exception is thrown from the main thread and can be properly caught.

Now I'm wondering why this is working in MinGW. AFAIK, the CTRL-C signal handler will also be executed in a separate thread; hence it should also end up throwing the exception from the separate thread. Could anyone with a MinGW build (and debug enabled) confirm whether octave_interrupt_exception is thrown from a worker thread or from the main thread. That is:
- put a breakpoint in octave_throw_interrupt_exception() (liboctave/cruft/misc/quit.cc)
- put a breakpoint in the catch clause for octave_interrupt_exception, in main_loop() (libinterp/interfcn/toplev.cc)
- hit CTRL-C at octave prompt when idle
- use "info threads" to see what thread is active when the exception is thrown and is caught

Michael.


reply via email to

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