Chapter 10. Interrupting Commands

Commands can be interrupted, if the Amazons program supports it. This is useful, for example, if the move generation takes a long time, to give the user the ability to stop the current move generation and gain control over the interface again.

There are two ways of sending the interrupt signal to the program:

  1. The Amazons program reads the ATP input stream, while processing a command, and can interrupt the current command, if the special comment line # interrupt is received. The Amazons program indicates this ability by implementing the command amazonsgui-interrupt.

  2. The alternative way is that the program can handle INT signals. It indicates this by implementing the amazonsgui-sigint command and returning its process ID. AmazonsGui will then send an INT signal to the process by invoking the shell command kill -INT pid. However, this will work only on UNIX systems and lacks the feature of transmitting interrupt signals over network ATP streams.

If the program does not support any of these methods, AmazonsGui will offer to kill and detach the program.