Re: interrupt signal in MSW

<[email protected]> Mon, 7 May 2018 14:49:27 +0000
Newsgroups gmane.lisp.clisp.general
Message-ID <da1ab3e1774e475f9a40e6800e68a35f@HE105658.emea1.cds.t-internal.com>
Hi,

Gunter Königsmann writes:
>In the meantime I have found something - even if not the full solution:
>On Windows a GenerateConsoleCtrlEvent(CTRL_C_EVENT, pid)
>sends an Ctrl+C event to the lisp with the pid "pid" - that is exactly the event that arrives if Ctrl+C is pressed.
>On clisp this event is currently ignored on Windows, but works on Linux. Does anyone know how to make clisp react to it on Windows, too?

>GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, pid)
>acts as Ctrl+Break were pressed, instead. This event immediately crashes clisp on Windows, currently.
>But that might not be a bug but a convenient way to enter an eventually-running debugger => In case that
>Ctrl+C doesn't work on Windows: Is there a way to make use of this event, instead?

"crashes" or terminates? See
https://gitlab.com/gnu-clisp/clisp/blob/master/src/win32aux.d#L46
/* Ctrl-C-interruptibility.
 We treat Ctrl-C as under Unix: Enter a break loop, continuable if possible.
 We treat Ctrl-Break as usual under Windows: abort the application, as if
 (exit t) was called, with exit code 130.

I don't believe Ctrl-Break is configurable. See line 147 of this file:
    } else {
      if (interruptible_abort_code == 1+CTRL_BREAK_EVENT) {
        final_exitcode = 130; quit(); /* aborted by Ctrl-Break */

However Ctrl-C ought to work. Does it work when you invoke clisp directly in a console, without GUI, on your machine?
E.g. can you interrupt a REPL running (CL:LOOP)?


@Bruno: You wrote in line 181:
>  we don't know in which thread the handler installed via
>   SetConsoleCtrlHandler() will be executed (main thread? separate thread?
>   any other thread?),

Yet normal_interrupt_handler contains a call to OS_error:
>      if (!PulseEvent(sigint_event)) {
>        OS_error();
Can OS_error really be raised from that unknown thread??
I don't think so.
There's also a call to OS_error in temp_interrupt_handler

Regards,
	Jörg Höhle

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list