Application termination

The OPTIONS TERMINATE SIGNAL defines a callback function in case of SIGTERM signal.

Syntax

OPTIONS ON TERMINATE SIGNAL CALL function

Usage

The OPTIONS ON TERMINATE SIGNAL CALL function defines the function that must be called when the application receives the SIGTERM signal. With this option, you can control program termination. If this statement is not called, the program is stopped with an exit value of SIGTERM (15).

On Microsoft™ Windows® platforms, the function will be called in the following cases:

  • The console window that the program was started from is closed.
  • The current user session is terminated (i.e. the user logs off).
  • The system is shut down.

Use the OPTIONS ON TERMINATE SIGNAL CALL function instruction with care, and do not execute complex code in the callback function. The code is expected to contain only simple and short cleanup operations; any interactive instruction must be avoided.