Previous Up Next

Chapter 14  Events and Interrupts

The normal execution of a Prolog program may be interrupted by events and interrupts:

Events

Events have the following properties:
  • they may occur asynchronously (when posted by the environment) or synchronously (when raised by the program itself);
  • they are handled synchronously by a handler goal that is inserted into the resolvent;
  • the handler can cause the interrupted execution to fail or to abort;
  • the handler can interact with the interrupted execution only via non-logical features (e.g., global variable or references);
  • the handler can cause waking of delayed goals via symbolic triggers.
Errors

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

Interrupts usually originate from the operating system, e.g., on a Unix host, signals are mapped to ECLiPSe interrupts.
  • they occur asynchronously, but may be mapped into a sychronous event;
  • certain predefined actions (like aborting) can be performed asynchronously.

Previous Up Next