[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ctrl-c and oct files
From: |
John Donoghue |
Subject: |
Re: ctrl-c and oct files |
Date: |
Mon, 30 Apr 2018 20:04:04 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
Further more, if I try something such as:
#include <octave/oct.h>
#include <octave/sighandlers.h>
#include <unistd.h>
void catch_ctrl(int sig)
{
printf("catch here %d\n", sig);
}
DEFUN_DLD (testctrl, args, nargout, "Test Ctrl-C")
{
printf("starting sleep\n");
auto old_handler = octave::set_signal_handler(SIGINT, catch_ctrl);
sleep(10);
octave::set_signal_handler(SIGINT, old_handler);
printf("finished sleep\n");
return octave_value();
}
and press ctrl-c, catch_ctrl never displays anything.
#include <octave/oct.h>
#include <unistd.h>
DEFUN_DLD (testctrl, args, nargout, "Test Ctrl-C")
{
printf("starting sleep\n");
BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
sleep(10);
END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
printf("finished sleep\n");
return octave_value();
}
Build with mkoctfile, in fedora 26, with octave 4.3.92, hg
25327:abc5095d58c2
Running it with octave --no-gui, when I run testctrl, and press ctrl-c
after a second, shouldn't the code break out?
Currently, for me, ctrl-c doesnt appear to do anything - the prints
execute after the 10 second sleep, rather than breaking out part way
through the sleep.
octave --gui does the same.