Next: , Previous: Pragma Interrupt_Handler, Up: Implementation Defined Pragmas


2.87 Pragma Interrupt_State

Syntax:

    pragma Interrupt_State
     ([Name  =>] value,
      [State =>] SYSTEM | RUNTIME | USER);

Normally certain interrupts are reserved to the implementation. Any attempt to attach an interrupt causes Program_Error to be raised, as described in RM C.3.2(22). A typical example is the SIGINT interrupt used in many systems for an Ctrl-C interrupt. Normally this interrupt is reserved to the implementation, so that Ctrl-C can be used to interrupt execution. Additionally, signals such as SIGSEGV, SIGABRT, SIGFPE and SIGILL are often mapped to specific Ada exceptions, or used to implement run-time functions such as the abort statement and stack overflow checking.

Pragma Interrupt_State provides a general mechanism for overriding such uses of interrupts. It subsumes the functionality of pragma Unreserve_All_Interrupts. Pragma Interrupt_State is not available on Windows or VMS. On all other platforms than VxWorks, it applies to signals; on VxWorks, it applies to vectored hardware interrupts and may be used to mark interrupts required by the board support package as reserved.

Interrupts can be in one of three states:

These states are the allowed values of the State parameter of the pragma. The Name parameter is a value of the type Ada.Interrupts.Interrupt_ID. Typically, it is a name declared in Ada.Interrupts.Names.

This is a configuration pragma, and the binder will check that there are no inconsistencies between different units in a partition in how a given interrupt is specified. It may appear anywhere a pragma is legal.

The effect is to move the interrupt to the specified state.

By declaring interrupts to be SYSTEM, you guarantee the standard system action, such as a core dump.

By declaring interrupts to be USER, you guarantee that you can install a handler.

Note that certain signals on many operating systems cannot be caught and handled by applications. In such cases, the pragma is ignored. See the operating system documentation, or the value of the array Reserved declared in the spec of package System.OS_Interface.

Overriding the default state of signals used by the Ada runtime may interfere with an application's runtime behavior in the cases of the synchronous signals, and in the case of the signal used to implement the abort statement.