All Packages Class Hierarchy This Package Previous Next Index
Most platforms have some provision for interrupting a program -- command-period on the Macintosh, control-C in Unix, possibly a window manager menu item, or other possibilities. This can happen at any time, including while execution is nested inside one of your own functions, or inside a Glk library function.
If you need to clean up critical resources, you can specify an interrupt handler function.
In Java, do this by implementing the InterruptListener interface, and calling Glk.setInterruptHandler().
public abstract void interrupt()
This handler will be called before the process is shut down.
You should not try to interact with the player in your interrupt handler. Do not call Glk.select() or Glk.selectPoll(). Anything you print to a window may not be visible to the player.
All Packages Class Hierarchy This Package Previous Next Index