Pragmas Interrupt_Handler and Attach_Handler
Author: JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor

Ada Reference Manual — Legal Information

# J.15.7 Pragmas Interrupt_Handler and Attach_Handler

#### Syntax

1/3
The form of a pragma Interrupt_Handler is as follows:
2/3
pragma Interrupt_Handler (handler_ name);
3/3
The form of a pragma Attach_Handler is as follows:
4/3
pragma Attach_Handler (handler_ name, expression);

#### Name Resolution Rules

5/3
For the Interrupt_Handler and Attach_Handler pragmas, the handler_ name shall resolve to denote a protected procedure with a parameterless profile.
6/3
For the Attach_Handler pragma, the expected type for the expression is Interrupts.Interrupt_Id (see C.3.2).

#### Legality Rules

7/3
The Attach_Handler and Interrupt_Handler pragmas are only allowed immediately within the protected_definition where the corresponding subprogram is declared. The corresponding protected_type_declaration or single_protected_declaration shall be a library-level declaration, and shall not be declared within a generic body. In addition to the places where Legality Rules normally apply (see 12.3), these rules also apply in the private part of an instance of a generic unit.

#### Static Semantics

8/3
For an implementation that supports Annex C, a pragma Interrupt_Handler specifies the Interrupt_Handler aspect (see C.3.1) for the protected procedure handler_ name to have the value True. For an implementation that supports Annex C, a pragma Attach_Handler specifies the Attach_Handler aspect (see C.3.1) for the protected procedure handler_ name to have the value of the given expression as evaluated at object creation time.

Ada 2005 and 2012 Editions sponsored in part by Ada-Europe