Go to the first, previous, next, last section, table of contents.


Timeout Predicate

The timeout package, which may be loaded by the query

| ?- use_module(library(timeout)).

contains the predicate:

time_out(:Goal, +Time, ?Result)
The Goal is executed as if by call/1. If computing any solution takes more than Time milliseconds, process virtual time, the goal will fail and Result is 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.

time_out/3 is implemented by raising and handling time_out exceptions, so any exception handler in the scope of Goal must be prepared to pass on time_out exceptions. The following incorrect example shows what can happen otherwise:

| ?- time_out(on_exception(Q,(repeat,false),true), 1000, Res).
Q = time_out,
Res = success


Go to the first, previous, next, last section, table of contents.