diff libgui/src/thread-manager.cc @ 17958:1adf3710bb68

Working CTRL-C handling implementation for Win32. * libgui/src/thread-manager.cc (sighandlers.h): New include. (windows_thread_manager::interrupt): Call w32_raise_sigint instead of ::raise. * libinterp/corefcn/sighandlers.h (w32_raise_sigint): New declatation. * libinterp/cirefcn/sighandlers.cc (user_abort): Forward declare. (class w32_interrupt_manager): New singleton helper class. (w32_raise_sigint): New function. (user_abort): Call w32_interrupt_manager::octave_jump_to_enclosing_context instead of octave_jump_to_enclosing_context on Win32 platform. (sigint_handler): Call w32_interrupt_manager::user_abort instead of user_abort on Win32 platform. (octave_catch_interrupts, octave_ignore_interrupts, octave_set_interrupt_handler): Call w32_interrupt_manager::init on Win32 platform. * liboctave/util/oct-rl-edit.c (octave_rl_initialize): Set rl_catch_signals to 0 on Win32 platform.
author Michael Goffioul <michael.goffioul@gmail.com>
date Tue, 19 Nov 2013 14:21:38 -0500
parents b5bf26a054bd
children 54784619350b
line wrap: on
line diff
--- a/libgui/src/thread-manager.cc
+++ b/libgui/src/thread-manager.cc
@@ -33,6 +33,7 @@
 #include <sys/types.h>
 #include <signal.h>
 
+#include "sighandlers.h"
 #include "thread-manager.h"
 
 #if defined (__WIN32__) && ! defined (__CYGWIN__)
@@ -47,15 +48,7 @@
 
   void interrupt (void)
   {
-    // FIXME: This doesn't work when octave_interrupt_immediately is
-    // true.  Octave crashes, presumably in the call to
-    // octave_jump_to_enclosing_context.  Does this happen because the
-    // jump occurs while Octave is running in the wrong thread?  That
-    // was happening on Unixy systems until we started using
-    // pthread_kill and blocking interrupts from all threads except the
-    // one running the Octave interpreter.
-
-    ::raise (SIGINT);
+    w32_raise_sigint ();
   }
 };