Did you know ... | Search Documentation: |
Janus and signals |
If Prolog is embedded into Python, SWI-Prolog is started with the --no-signals, i.e., SWI-Prolog does not install any signal handlers. This implies that signals are handled by Python. Python handles signals synchronously (as SWI-Prolog) when executing byte code. As Prolog execution does not involve Prolog execution, running a program like below cannot be in interrupted
import janus_swi as janus janus.query_once("repeat,fail")
If your program makes possibly slow Prolog queries and you want signal handling, you can enable a heartbeat.
To complete the picture, some Python exceptions are propagated through Prolog by mapping them into a Prolog exception and back again. This notably concerns
unwind(halt(code)
)
and back again when Prolog
returns control back to Python.unwind(keyboard_interrupt)