Interrupt Handling

The native console allows manually interrupting the interpreter loop either during read or during execution. The interrupt key (^C on Mac, Linux and Windows) will cause the invocation of an interrupt handler which will affect the interpreter.

For the development environment we decided to assign the pause function to the interrupt key. When the interrupt key is pressed the interrupt handler will change the debugging mode to step in and leash all ports. If the debugging mode was not off and if the program contains traceable predicates, this will cause a debugger prompt with user interaction.

> 
Jekejeke Prolog, Development Environment 1.0.7
(c) 1985-2015, XLOG Technologies GmbH, Switzerland
?- debug.
Yes
?- repeat, fail.
^C
    0 Exit repeat ?

In the above example the interpreter hangs in an infinite computation from the repeat fail query. The interrupt key allows pausing this infinite computation.

Comments