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 runtime library we decided to assign the exit function to the interrupt key. When the interrupt key is pressed the interrupt handler will signal a system error of type user exit. When not otherwise trapped, this will cause an exit of the current session.

> 
Jekejeke Prolog, Runtime Library 1.0.7
(c) 1985-2015, XLOG Technologies GmbH, Switzerland
?- repeat, fail.
^C
>

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


Comments