Prolog timeout mechanisms and foreign-language interface: interrupting long-running C predicates
When a Prolog engine enforces a time or inference limit via call_with_time_limit/2 or thread_signal/2 , the VM relies on periodic checks that only occur at safe points—typically when control returns to Prolog or when foreign code explicitly calls PL_handle_signals() (SWI-Prolog) or SP_check_interrupt() (SICStus). A deterministic C predicate that runs a tight