Previous Up Next

Chapter 13  Events and Interrupts

The normal execution of a Prolog program may be interrupted by Events and Interrupts:


Errors can be viewed as a special case of events. They are raised by built-in predicates (e.g. when the arguments are of the wrong type) and usually pass the culprit goal to the error handler.


Interrupts usually originate from the operating system, e.g. on a Unix host, signals are mapped to ECLiPSe interrupts.

This is time that the CPU spends on executing user code, i.e. the ECLiPSe program.
Since implementing reliable timeouts is a nontrivial task, we recommend the use of lib(timeout) for this purpose.
This is necessary because the compiler recognises simple predicates as deterministic at compile time and so if a simple predicate would cause the invocation of a non-deterministic error handler, the generated code may no longer be correct.
Note that some events are not errors but are used for different purposes. In thoses cases the second and third argument are sometimes used differently. See Appendix C for details.

Previous Up Next