10.26 Meta-Call with Limit on Execution Time—library(timeout)

Exported predicates:

time_out(:Goal, +Time, -Result)
The Goal is executed as if by call/1. If computing any solution takes more than Time milliseconds, the goal will be aborted and Result unified with the atom time_out. If the goal succeeds within the specified time, Result is unified with the atom success. Time must be a number between (not including) 0 and 2147483647.

The time is measured in process virtual time under UNIX. Under Windows NT/2000/XP, as of SICStus 3.10, thread virtual time is used, which is the same as process virtual time for single-threaded processes.

The precision of the time out interval is usually not better than several tens of milliseconds. This is due to limitations in the timing mechanisms used to implement library(timeout).

time_out/3 is implemented by raising and handling time_out exceptions but, as of SICStus Prolog 4.1.3, these exceptions will not be intercepted by the normal exception handlers (on_exception/3 and catch/3).


Send feedback on this subject.