GAP.jl icon indicating copy to clipboard operation
GAP.jl copied to clipboard

GAP catches user interrupt via Ctrl-C

Open fingolfin opened this issue 6 years ago • 2 comments

Import from https://github.com/oscar-system/LibGAP.jl/issues/2

@ThomasBreuer wrote:

When one loads libgap into julia then a double ''-C'' entered in a long julia computation is apparently caught by GAP, with the effect that julia is left, with the well-known message that is printed by GAP: "gap: you hit '-C' twice in a second, goodbye."

Is this intended?

@wbhart replied:

We had the same problem when we used to call Pari from Nemo. We will have to work on handlers so that the two can cooperate.

@sebasguts replied:

I think this might need some modification in LibGAP. A library should never implement a signal handler.

Since GAP sets the signal handler at start-up (in sysfiles.c), and GAP is loaded after Julia, and programs can only have one handler per signal, the Julia handler certainly gets overwritten. The proper solution would be that LibGAP exposes an interrupt-function, which could be used by the Julia signal handler to interrupt the GAP computation. I will talk to Markus about this issue. Probably a first step is to disable the signal handler for LibGAP, and then think about implementing some interrupt function.

fingolfin avatar Oct 15 '18 10:10 fingolfin

The problem exists in the other direction, too: When using JuliaInterface, using Ctrl-C immediately kills GAP instead of entering a break loop.

fingolfin avatar Nov 06 '18 08:11 fingolfin

Julia supports setting a signal handler, using jl_install_sigint_handler. Should we set it to the GAP SIGINT handler in JuliaInterface after Julia is loaded?

sebasguts avatar Nov 06 '18 11:11 sebasguts