| 1 |
@comment{ $Source: e:\\cvsroot/ARM/Source/sp.mss,v $ } |
| 2 |
@comment{ $Revision: 1.47 $ $Date: 2006/10/18 00:25:28 $ $Author: Randy $ } |
| 3 |
@Part(sysprog, Root="ada.mss") |
| 4 |
@Comment{$Date: 2006/10/18 00:25:28 $} |
| 5 |
|
| 6 |
@LabeledNormativeAnnex{Systems Programming} |
| 7 |
|
| 8 |
@begin{Intro} |
| 9 |
@Redundant[@Defn{systems programming} |
| 10 |
@Defn{low-level programming} |
| 11 |
@Defn{real-time systems} |
| 12 |
@Defn{embedded systems} |
| 13 |
@Defn{distributed systems} |
| 14 |
@Defn{information systems} |
| 15 |
The Systems Programming Annex specifies additional capabilities |
| 16 |
provided for low-level programming. These capabilities are also |
| 17 |
required in many real-time, embedded, distributed, and information systems.] |
| 18 |
@end{Intro} |
| 19 |
|
| 20 |
@begin{Extend83} |
| 21 |
@Defn{extensions to Ada 83} |
| 22 |
This Annex is new to Ada 95. |
| 23 |
@end{Extend83} |
| 24 |
|
| 25 |
@LabeledClause{Access to Machine Operations} |
| 26 |
|
| 27 |
@begin{Intro} |
| 28 |
@Redundant[This clause specifies rules regarding access to machine instructions |
| 29 |
from within an Ada program.] |
| 30 |
@ChgImplDef{Version=[2],Kind=[Revised],Text=[@Chg{Version=[2], |
| 31 |
New=[Implementation-defined intrinsic subprograms], |
| 32 |
Old=[Support for access to machine instructions]}.]} |
| 33 |
@end{Intro} |
| 34 |
|
| 35 |
@begin{ImplReq} |
| 36 |
@Defn{machine code insertion} |
| 37 |
The implementation shall support machine code insertions |
| 38 |
(see @RefSecNum{Machine Code Insertions}) or intrinsic subprograms |
| 39 |
(see @RefSecNum{Conformance Rules}) (or both). |
| 40 |
Implementation-defined attributes shall be provided to |
| 41 |
allow the use of Ada entities as operands. |
| 42 |
@end{ImplReq} |
| 43 |
|
| 44 |
@begin{ImplAdvice} |
| 45 |
The machine code or intrinsics support should allow access to all |
| 46 |
operations normally available to assembly language programmers for the |
| 47 |
target environment, |
| 48 |
including privileged instructions, if any. |
| 49 |
@ChgImplAdvice{Version=[2],Kind=[Added],Text=[@ChgAdded{Version=[2], |
| 50 |
Text=[The machine code or intrinsics support should allow access to all |
| 51 |
operations normally available to assembly language programmers for the |
| 52 |
target environment.]}]} |
| 53 |
@begin{Ramification} |
| 54 |
Of course, on a machine with protection, an attempt to execute a |
| 55 |
privileged instruction in user mode will probably trap. |
| 56 |
Nonetheless, we want implementations to provide access to them so that |
| 57 |
Ada can be used to write systems programs that run in privileged mode. |
| 58 |
@end{Ramification} |
| 59 |
|
| 60 |
@Defn{interface to assembly language} |
| 61 |
@Defn2{Term=[language], Sec=(interface to assembly)} |
| 62 |
@Defn{mixed-language programs} |
| 63 |
@Defn{assembly language} |
| 64 |
The interfacing pragmas (see @RefSecNum{Interface to Other Languages}) |
| 65 |
should support interface to assembler; |
| 66 |
the default assembler should be associated with the convention |
| 67 |
identifier Assembler. |
| 68 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 69 |
Text=[Interface to assembler should be supported; the default assembler |
| 70 |
should be associated with the convention identifier Assembler.]}]} |
| 71 |
|
| 72 |
If an entity is exported to assembly language, then the implementation |
| 73 |
should allocate it at an addressable location, |
| 74 |
and should ensure that it is retained by the linking process, |
| 75 |
even if not otherwise referenced from the Ada code. |
| 76 |
The implementation should assume that any call to a machine code or |
| 77 |
assembler subprogram is allowed to read or update every object that is |
| 78 |
specified as exported. |
| 79 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 80 |
Text=[If an entity is exported to assembly language, then the implementation |
| 81 |
should allocate it at an addressable location even if not otherwise referenced |
| 82 |
from the Ada code. A call to a machine code or assembler subprogram should |
| 83 |
be treated as if it could read or update every object that is |
| 84 |
specified as exported.]}]} |
| 85 |
@end{ImplAdvice} |
| 86 |
|
| 87 |
@begin{DocReq} |
| 88 |
|
| 89 |
The implementation shall document the overhead associated with calling |
| 90 |
machine-code or intrinsic subprograms, as compared to a fully-inlined |
| 91 |
call, and to a regular out-of-line call. |
| 92 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 93 |
Text=[The overhead of calling machine-code or intrinsic subprograms.]}]} |
| 94 |
|
| 95 |
The implementation shall document the types of |
| 96 |
the package System.Machine_Code usable for machine code |
| 97 |
insertions, and the attributes to be used in |
| 98 |
machine code insertions for references to Ada entities. |
| 99 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 100 |
Text=[The types and attributes used in machine code insertions.]}]} |
| 101 |
|
| 102 |
The implementation shall document the subprogram calling conventions |
| 103 |
associated with the convention identifiers available for use |
| 104 |
with the interfacing pragmas (Ada and Assembler, at a minimum), |
| 105 |
including register saving, |
| 106 |
exception propagation, parameter passing, and function value returning. |
| 107 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 108 |
Text=[The subprogram calling conventions for all supported convention |
| 109 |
identifiers.]}]} |
| 110 |
|
| 111 |
For exported and imported subprograms, |
| 112 |
the implementation shall document the mapping |
| 113 |
between the Link_Name string, if specified, or |
| 114 |
the Ada designator, if not, and the external link name used |
| 115 |
for such a subprogram. |
| 116 |
@ChgImplDef{Version=[2],Kind=[Deleted],Text=[@ChgDeleted{Version=[2], |
| 117 |
Text=[Implementation-defined aspects of access to machine operations.]}]} |
| 118 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 119 |
Text=[The mapping between the Link_Name or Ada designator and the external |
| 120 |
link name.]}]} |
| 121 |
|
| 122 |
@end{DocReq} |
| 123 |
|
| 124 |
@begin{ImplAdvice} |
| 125 |
|
| 126 |
The implementation should ensure that little or no overhead is associated |
| 127 |
with calling intrinsic and machine-code subprograms. |
| 128 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 129 |
Text=[Little or no overhead should be associated |
| 130 |
with calling intrinsic and machine-code subprograms.]}]} |
| 131 |
|
| 132 |
@Leading@;It is recommended that intrinsic subprograms be provided for convenient |
| 133 |
access to any machine operations that provide special capabilities |
| 134 |
or efficiency and that are not otherwise available through the language |
| 135 |
constructs. Examples of such instructions |
| 136 |
include: |
| 137 |
@begin{itemize} |
| 138 |
|
| 139 |
Atomic read-modify-write operations @em e.g., test and set, compare and swap, |
| 140 |
decrement and test, enqueue/dequeue. |
| 141 |
|
| 142 |
Standard numeric functions @em e.g., @i{sin}, @i{log}. |
| 143 |
|
| 144 |
String manipulation operations @em e.g., translate and test. |
| 145 |
|
| 146 |
Vector operations @em e.g., compare vector against thresholds. |
| 147 |
|
| 148 |
Direct operations on I/O ports. |
| 149 |
|
| 150 |
@end{itemize} |
| 151 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 152 |
Text=[Intrinsic subprograms should be provided to access any machine operations |
| 153 |
that provide special capabilities or efficiency not normally available.]}]} |
| 154 |
|
| 155 |
@end{ImplAdvice} |
| 156 |
|
| 157 |
@LabeledClause{Required Representation Support} |
| 158 |
|
| 159 |
@begin{Intro} |
| 160 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 161 |
This clause specifies minimal requirements on the |
| 162 |
@Chg{Version=[2],New=[],Old=[implementation's ]}support for representation |
| 163 |
items and related features. |
| 164 |
@end{Intro} |
| 165 |
|
| 166 |
@begin{ImplReq} |
| 167 |
@PDefn2{Term=[recommended level of support], Sec=(required in Systems |
| 168 |
Programming Annex)} |
| 169 |
The implementation shall support at least the functionality |
| 170 |
defined by the recommended levels of support in Section 13. |
| 171 |
@end{ImplReq} |
| 172 |
|
| 173 |
@LabeledClause{Interrupt Support} |
| 174 |
|
| 175 |
@begin{Intro} |
| 176 |
@Redundant[This clause specifies the language-defined model for hardware interrupts |
| 177 |
in addition to mechanisms for handling interrupts.] |
| 178 |
@IndexSee{Term=[signal],See=(interrupt)} |
| 179 |
@end{Intro} |
| 180 |
|
| 181 |
@begin{RunTime} |
| 182 |
|
| 183 |
@Defn{interrupt} |
| 184 |
@Redundant[An @i{interrupt} represents a class of events that are detected by |
| 185 |
the hardware or the system software.] |
| 186 |
@Defn2{Term=[occurrence], Sec=(of an interrupt)} |
| 187 |
Interrupts are said to occur. An @i{occurrence} of an interrupt is |
| 188 |
separable into generation and delivery. |
| 189 |
@Defn2{Term=[generation], Sec=(of an interrupt)} |
| 190 |
@i{Generation} of an interrupt is the event in the underlying hardware |
| 191 |
or system that makes the interrupt available to the program. |
| 192 |
@Defn2{Term=[delivery], Sec=(of an interrupt)} |
| 193 |
@i{Delivery} is the action that invokes part of the program as |
| 194 |
response to the interrupt occurrence. |
| 195 |
@Defn{pending interrupt occurrence} |
| 196 |
Between generation and delivery, the interrupt occurrence @Redundant[(or |
| 197 |
interrupt)] is @i{pending}. |
| 198 |
@Defn{blocked interrupt} |
| 199 |
Some or all interrupts may be @i{blocked}. When an interrupt is blocked, all |
| 200 |
occurrences of that interrupt are prevented from being delivered. |
| 201 |
@Defn2{Term=[attaching], Sec=(to an interrupt)} |
| 202 |
@Defn{reserved interrupt} |
| 203 |
Certain interrupts are @i{reserved}. The set of reserved interrupts is |
| 204 |
implementation defined. A reserved interrupt is either an interrupt for |
| 205 |
which user-defined handlers are not supported, or one which |
| 206 |
already has an attached handler by some other implementation-defined means. |
| 207 |
@Defn{interrupt handler}@PDefn2{Term=[handler],Sec=[interrupt]} |
| 208 |
Program units can be connected to non-reserved interrupts. While |
| 209 |
connected, the program unit is said to be @i{attached} to that interrupt. |
| 210 |
The execution of that program unit, the @i{interrupt handler}, is invoked upon |
| 211 |
delivery of the interrupt occurrence. |
| 212 |
@ChgImplDef{Version=[2],Kind=[Deleted],Text=[@ChgDeleted{Version=[2], |
| 213 |
Text=[Implementation-defined aspects of interrupts.]}]} |
| 214 |
@begin{Honest} |
| 215 |
As an obsolescent feature, |
| 216 |
interrupts may be attached to task entries by an address clause. |
| 217 |
See @RefSecNum{Interrupt Entries}. |
| 218 |
@end{Honest} |
| 219 |
|
| 220 |
While a handler is attached to an interrupt, it is called once for each |
| 221 |
delivered occurrence of that interrupt. While the handler executes, the |
| 222 |
corresponding interrupt is blocked. |
| 223 |
|
| 224 |
While an interrupt is blocked, all occurrences of that interrupt are prevented |
| 225 |
from being delivered. Whether such occurrences remain pending or are lost is |
| 226 |
implementation defined. |
| 227 |
|
| 228 |
@Defn{default treatment} |
| 229 |
Each interrupt has a @i{default treatment} which determines the system's |
| 230 |
response to an occurrence of that interrupt when no user-defined |
| 231 |
handler is attached. The set of possible default treatments is |
| 232 |
implementation defined, as is the method (if one exists) for configuring |
| 233 |
the default treatments for interrupts. |
| 234 |
|
| 235 |
An interrupt is delivered to the handler (or default treatment) that is in |
| 236 |
effect for that interrupt at the time of delivery. |
| 237 |
|
| 238 |
An exception propagated from a handler that is invoked by an |
| 239 |
interrupt has no effect. |
| 240 |
|
| 241 |
@Redundant[If the Ceiling_Locking policy (see @RefSecNum{Priority Ceiling Locking}) is |
| 242 |
in effect, the interrupt handler executes with the active priority that is the |
| 243 |
ceiling priority of the corresponding protected object.] |
| 244 |
|
| 245 |
@end{RunTime} |
| 246 |
|
| 247 |
@begin{ImplReq} |
| 248 |
|
| 249 |
The implementation shall provide a mechanism to determine the minimum |
| 250 |
stack space that is needed |
| 251 |
for each interrupt handler and to reserve that space for |
| 252 |
the execution of the handler. @Redundant{This space should accommodate |
| 253 |
nested invocations of the handler where the system permits this.} |
| 254 |
|
| 255 |
If the hardware or the underlying system holds pending interrupt |
| 256 |
occurrences, the implementation shall provide for later delivery |
| 257 |
of these occurrences to the program. |
| 258 |
|
| 259 |
If the Ceiling_Locking policy is not in effect, the implementation |
| 260 |
shall provide means for the application to specify whether interrupts |
| 261 |
are to be blocked during protected actions. |
| 262 |
|
| 263 |
@end{ImplReq} |
| 264 |
|
| 265 |
@begin{DocReq} |
| 266 |
@Leading@;The implementation shall document the following items: |
| 267 |
@begin{Discussion} |
| 268 |
This information may be different for different forms of interrupt handlers. |
| 269 |
@end{Discussion} |
| 270 |
@begin{Enumerate} |
| 271 |
For each interrupt, which interrupts are blocked from delivery when a handler |
| 272 |
attached to that interrupt executes (either as a result of an interrupt |
| 273 |
delivery or of an ordinary call on a procedure of the corresponding |
| 274 |
protected object). |
| 275 |
|
| 276 |
Any interrupts that cannot be blocked, and the effect of attaching |
| 277 |
handlers to such interrupts, if this is permitted. |
| 278 |
|
| 279 |
Which run-time stack an interrupt handler uses when it executes as a |
| 280 |
result of an interrupt delivery; if this is configurable, what is the |
| 281 |
mechanism to do so; how to specify how much space to reserve on that stack. |
| 282 |
|
| 283 |
Any implementation- or hardware-specific activity that happens |
| 284 |
before a user-defined interrupt handler gets control (e.g., |
| 285 |
reading device registers, acknowledging devices). |
| 286 |
|
| 287 |
Any timing or other limitations imposed on the execution of interrupt handlers. |
| 288 |
|
| 289 |
The state (blocked/unblocked) of the non-reserved interrupts |
| 290 |
when the program starts; if some interrupts are unblocked, what |
| 291 |
is the mechanism a program can use to protect itself before it |
| 292 |
can attach the corresponding handlers. |
| 293 |
|
| 294 |
Whether the interrupted task is allowed to resume execution before the |
| 295 |
interrupt handler returns. |
| 296 |
|
| 297 |
The treatment of interrupt occurrences that are generated while |
| 298 |
the interrupt is blocked; i.e., whether one or more occurrences |
| 299 |
are held for later delivery, or all are lost. |
| 300 |
|
| 301 |
Whether predefined or implementation-defined exceptions are raised as a |
| 302 |
result of the occurrence of any interrupt, and the mapping between the |
| 303 |
machine interrupts (or traps) and the predefined |
| 304 |
exceptions. |
| 305 |
|
| 306 |
On a multi-processor, the rules governing the delivery of an interrupt |
| 307 |
to a particular processor. |
| 308 |
@end{Enumerate} |
| 309 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 310 |
Text=[The treatment of interrupts.]}]} |
| 311 |
@ChgNote{A Bob Duff explanation, but this is just too much junk.} |
| 312 |
@end{DocReq} |
| 313 |
|
| 314 |
@begin{ImplPerm} |
| 315 |
|
| 316 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 317 |
If the underlying system or hardware does not allow interrupts to be |
| 318 |
blocked, then no blocking is required @Redundant[as part of the execution of |
| 319 |
subprograms of a protected object @Chg{Version=[2],New=[for which],Old=[whose]} |
| 320 |
one of its subprograms is an interrupt handler]. |
| 321 |
|
| 322 |
In a multi-processor with more than one interrupt subsystem, it is |
| 323 |
implementation defined whether (and how) interrupt sources from |
| 324 |
separate subsystems share the same Interrupt_ID type |
| 325 |
(see @RefSecNum{The Package Interrupts}). |
| 326 |
In particular, the meaning of a blocked or pending interrupt may then be |
| 327 |
applicable to one processor only. |
| 328 |
@begin{discussion} |
| 329 |
This issue is tightly related to the issue of scheduling on a |
| 330 |
multi-processor. In a sense, if a particular interrupt source is not |
| 331 |
available to all processors, the system is not truly homogeneous. |
| 332 |
|
| 333 |
One way to approach this problem is to assign sub-ranges within |
| 334 |
Interrupt_ID to each interrupt subsystem, such that @lquotes@;similar@rquotes@; interrupt |
| 335 |
sources (e.g. a timer) in different subsystems get a distinct id. |
| 336 |
@end{Discussion} |
| 337 |
|
| 338 |
Implementations are allowed to impose timing or other limitations on the |
| 339 |
execution of interrupt handlers. |
| 340 |
@begin{Reason} |
| 341 |
These limitations are often necessary to ensure proper behavior of the |
| 342 |
implementation. |
| 343 |
@end{Reason} |
| 344 |
|
| 345 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 346 |
Other forms of handlers are allowed to be supported, in which |
| 347 |
case@Chg{Version=[2],New=[],Old=[,]} the |
| 348 |
rules of this @Chg{Version=[2],New=[clause],Old=[subclause]} should be adhered |
| 349 |
to. |
| 350 |
|
| 351 |
The active priority of the execution of an interrupt handler is allowed to |
| 352 |
vary from one occurrence of the same interrupt to another. |
| 353 |
|
| 354 |
@end{ImplPerm} |
| 355 |
|
| 356 |
@begin{ImplAdvice} |
| 357 |
|
| 358 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 359 |
If the Ceiling_Locking policy is not in effect, the implementation |
| 360 |
should provide means for the application to specify which interrupts |
| 361 |
are to be blocked during protected actions, if the underlying system allows |
| 362 |
for @Chg{Version=[2],New=[finer-grained],Old=[a finer-grain]} control of |
| 363 |
interrupt blocking. |
| 364 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 365 |
Text=[If the Ceiling_Locking policy is not in effect and the target system |
| 366 |
allows for finer-grained control of interrupt blocking, a means for the |
| 367 |
application to specify which interrupts are to be blocked during protected |
| 368 |
actions should be provided.]}]} |
| 369 |
|
| 370 |
@end{ImplAdvice} |
| 371 |
|
| 372 |
@begin{Notes} |
| 373 |
|
| 374 |
The default treatment for an interrupt can be to keep the |
| 375 |
interrupt pending or to deliver it to an implementation-defined |
| 376 |
handler. Examples of actions that an implementation-defined |
| 377 |
handler is allowed to perform include aborting the partition, ignoring |
| 378 |
(i.e., discarding occurrences of) the interrupt, or queuing one |
| 379 |
or more occurrences of the interrupt for possible later delivery |
| 380 |
when a user-defined handler is attached to that interrupt. |
| 381 |
|
| 382 |
It is a bounded error to call Task_Identification.Current_Task |
| 383 |
(see @RefSecNum{The Package Task_Identification}) from an interrupt handler. |
| 384 |
|
| 385 |
The rule that an exception propagated from an interrupt handler has no effect |
| 386 |
is modeled after the rule about exceptions propagated out of task bodies. |
| 387 |
|
| 388 |
@end{Notes} |
| 389 |
|
| 390 |
@LabeledSubClause{Protected Procedure Handlers} |
| 391 |
|
| 392 |
@begin{Syntax} |
| 393 |
@begin{SyntaxText} |
| 394 |
@Leading@keepnext@;The form of a @nt{pragma} Interrupt_Handler is as follows: |
| 395 |
@end{SyntaxText} |
| 396 |
|
| 397 |
@PragmaSyn`@key{pragma} @prag(Interrupt_Handler)(@SynI{handler_}@Syn2{name});' |
| 398 |
|
| 399 |
@begin{SyntaxText} |
| 400 |
@Leading@Keepnext@;The form of a @nt{pragma} Attach_Handler is as follows: |
| 401 |
@end{SyntaxText} |
| 402 |
|
| 403 |
@PragmaSyn`@key{pragma} @prag(Attach_Handler)(@SynI{handler_}@Syn2{name}, @Syn2{expression});' |
| 404 |
@end{Syntax} |
| 405 |
|
| 406 |
@begin{Resolution} |
| 407 |
For the Interrupt_Handler and Attach_Handler pragmas, the |
| 408 |
@SynI{handler_}@nt{name} shall resolve to denote a protected procedure |
| 409 |
with a parameterless profile. |
| 410 |
|
| 411 |
For the Attach_Handler pragma, the expected type for the |
| 412 |
@nt{expression} is Interrupts.Interrupt_ID |
| 413 |
(see @RefSecNum{The Package Interrupts}). |
| 414 |
@end{Resolution} |
| 415 |
|
| 416 |
@begin{Legality} |
| 417 |
|
| 418 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 419 |
The Attach_Handler pragma is only allowed immediately within the |
| 420 |
@nt{protected_definition} |
| 421 |
where the corresponding subprogram is declared. |
| 422 |
The corresponding @nt{protected_@!type_@!declaration} |
| 423 |
or @nt{single_@!protected_@!declaration} |
| 424 |
shall be a library@Chg{Version=[2],New=[-],Old=[]}level declaration. |
| 425 |
@begin{Discussion} |
| 426 |
In the case of a @nt{protected_type_declaration}, |
| 427 |
an @nt{object_declaration} of an object of that type |
| 428 |
need not be at library level. |
| 429 |
@end{Discussion} |
| 430 |
|
| 431 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00253-01],ARef=[AI95-00303-01]} |
| 432 |
The Interrupt_Handler pragma is only allowed immediately within |
| 433 |
@Chg{Version=[2],New=[the],Old=[a]} |
| 434 |
@nt{protected_definition}@Chg{Version=[2],New=[ where the |
| 435 |
corresponding subprogram is declared],Old=[]}. |
| 436 |
The cor@!responding @nt{protected_@!type_declaration} @Chg{Version=[2],New=[or |
| 437 |
@nt{single_@!protected_@!declaration} ],Old=[]}shall |
| 438 |
be a library@Chg{Version=[2],New=[-],Old=[]}level |
| 439 |
declaration.@Chg{Version=[2],New=[],Old=[ In addition, any |
| 440 |
@nt{object_@!declaration} of such a type shall be a library level declaration.]} |
| 441 |
@end{Legality} |
| 442 |
|
| 443 |
@begin{RunTime} |
| 444 |
|
| 445 |
If the pragma Interrupt_Handler appears in a @nt{protected_definition}, |
| 446 |
then the corresponding procedure can be attached dynamically, as a handler, to |
| 447 |
interrupts (see @RefSecNum{The Package Interrupts}). |
| 448 |
@Redundant[Such procedures are allowed to be attached to multiple interrupts.] |
| 449 |
|
| 450 |
@Defn2{Term=[creation], Sec=(of a protected object)} |
| 451 |
@Defn2{Term=[initialization], Sec=(of a protected object)} |
| 452 |
The @nt{expression} in the Attach_Handler pragma @Redundant[as evaluated at |
| 453 |
object creation time] specifies an interrupt. As part |
| 454 |
of the initialization of that object, if the Attach_Handler pragma is |
| 455 |
specified, the @SynI{handler} procedure is attached to the specified interrupt. |
| 456 |
@IndexCheck{Reserved_Check} |
| 457 |
A check is made that the corresponding interrupt is not reserved. |
| 458 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of run-time check)} |
| 459 |
Program_Error is raised if the check fails, and the existing treatment |
| 460 |
for the interrupt is not affected. |
| 461 |
|
| 462 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 463 |
@Defn2{Term=[initialization], Sec=(of a protected object)} |
| 464 |
@IndexCheck{Ceiling_Check} |
| 465 |
If the Ceiling_Locking policy (see @RefSecNum{Priority Ceiling Locking}) is |
| 466 |
in effect@Chg{Version=[2],New=[,],Old=[]} then upon the initialization of a |
| 467 |
protected object @Chg{Version=[2],New=[for which],Old=[that]} either an |
| 468 |
Attach_Handler or Interrupt_Handler pragma applies to one of its procedures, |
| 469 |
a check is made that the ceiling priority defined in the |
| 470 |
@nt{protected_definition} is in the range of System.@!Interrupt_Priority. |
| 471 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of run-time check)} |
| 472 |
If the check fails, Program_Error is raised. |
| 473 |
|
| 474 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0068],ARef=[AI95-00121-01]} |
| 475 |
@Defn2{Term=[finalization], Sec=(of a protected object)} |
| 476 |
When a protected object is finalized, for any of its procedures that are |
| 477 |
attached to interrupts, the handler is detached. If the handler was |
| 478 |
attached by a procedure in the Interrupts package or if no user |
| 479 |
handler was previously attached to the interrupt, the default treatment is |
| 480 |
restored. @Chg{New=[If an Attach_@!Handler pragma was used and the most recently |
| 481 |
attached handler for the same interrupt is the same as the one that was |
| 482 |
attached at the time the protected object was initialized], |
| 483 |
Old=[Otherwise, @Redundant[that is, if an Attach_@!Handler pragma was |
| 484 |
used]]}, the previous handler is restored. |
| 485 |
@begin{Discussion} |
| 486 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0068],ARef=[AI95-00121-01]} |
| 487 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00303-01]} |
| 488 |
@Chg{New=[If all protected objects for interrupt handlers are declared at the |
| 489 |
library@Chg{Version=[2],New=[ ],Old=[-]}level],Old=[Since only library-level |
| 490 |
protected procedures can be attached as |
| 491 |
handlers using the Interrupts package]}, the finalization discussed above |
| 492 |
occurs only as part of the finalization of all library-level packages in |
| 493 |
a partition. |
| 494 |
@Chg{New=[However, objects of a protected type containing an Attach_@!Handler |
| 495 |
pragma need not be at the library level. Thus, an implementation needs to be |
| 496 |
able to restore handlers during the execution of the program.@Chg{Version=[2], |
| 497 |
New=[ (An object with an Interrupt_@!Handler pragma also need not be at the |
| 498 |
library level, but such |
| 499 |
a handler cannot be attached to an interrupt using the Interrupts package.)], |
| 500 |
Old=[]}],Old=[]} |
| 501 |
@end{Discussion} |
| 502 |
|
| 503 |
When a handler is attached to an interrupt, the interrupt is blocked |
| 504 |
@Redundant[(subject to the @ImplPermName in @RefSecNum{Interrupt Support})] |
| 505 |
during the execution of every protected action on the protected object |
| 506 |
containing the handler. |
| 507 |
|
| 508 |
@end{RunTime} |
| 509 |
|
| 510 |
@begin{Erron} |
| 511 |
@PDefn2{Term=(erroneous execution),Sec=(cause)} |
| 512 |
If the Ceiling_Locking policy (see @RefSecNum{Priority Ceiling Locking}) is |
| 513 |
in effect and an interrupt is delivered to a handler, and the interrupt |
| 514 |
hardware priority is higher than the ceiling priority of the corresponding |
| 515 |
protected object, the execution of the program is erroneous. |
| 516 |
|
| 517 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0068],ARef=[AI95-00121-01]} |
| 518 |
@ChgAdded{Version=[1],Text=[@PDefn2{Term=(erroneous execution),Sec=(cause)} |
| 519 |
If the handlers for a given interrupt attached via pragma |
| 520 |
Attach_Handler are not attached and detached in a stack-like (LIFO) order, |
| 521 |
program execution is erroneous. In particular, when a protected object is |
| 522 |
finalized, the execution is erroneous if any of the procedures of the |
| 523 |
protected object are attached to interrupts via pragma Attach_@!Handler and |
| 524 |
the most recently attached handler for the same interrupt is not the same as |
| 525 |
the one that was attached at the time the protected object was initialized.]} |
| 526 |
@begin{Discussion} |
| 527 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0068],ARef=[AI95-00121-01]} |
| 528 |
@ChgAdded{Version=[1],Text=[This simplifies implementation of the Attach_@!Handler |
| 529 |
pragma by not requiring a check that the current handler is the same as the |
| 530 |
one attached by the initialization of a protected object.]} |
| 531 |
@end{Discussion} |
| 532 |
@end{Erron} |
| 533 |
|
| 534 |
@begin{Metrics} |
| 535 |
@Leading@Keepnext@;The following metric shall be documented by the implementation: |
| 536 |
@ChgNote{This was @begin{enumerate}, which is wrong} |
| 537 |
@begin{Itemize} |
| 538 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 539 |
The worst@Chg{Version=[2],New=[-],Old=[ ]}case overhead for an interrupt |
| 540 |
handler that is a parameterless |
| 541 |
protected procedure, in clock cycles. This is the execution time not |
| 542 |
directly attributable to the handler procedure or the interrupted execution. |
| 543 |
It is estimated as C @en@; (A+B), where A is how long it takes to complete a given |
| 544 |
sequence of instructions without any interrupt, B is how long it takes to |
| 545 |
complete a normal call to a given protected procedure, and C is how long it |
| 546 |
takes to complete the same sequence of instructions when it is interrupted by |
| 547 |
one execution of the same procedure called via an interrupt. |
| 548 |
@begin{ImplNote} |
| 549 |
The instruction sequence and interrupt handler used to measure interrupt |
| 550 |
handling overhead should be chosen so as to maximize the execution time cost |
| 551 |
due to cache misses. For example, if the processor has cache memory and the |
| 552 |
activity of an interrupt handler could invalidate the contents of cache memory, the handler should be written such that it invalidates all of the cache memory. |
| 553 |
@end{ImplNote} |
| 554 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 555 |
Text=[The metrics for interrupt handlers.]}]} |
| 556 |
@ChgNote{This was @end{enumerate}, which is wrong} |
| 557 |
@end{Itemize} |
| 558 |
@end{Metrics} |
| 559 |
|
| 560 |
@begin{ImplPerm} |
| 561 |
When the pragmas Attach_Handler or Interrupt_Handler apply to a protected |
| 562 |
procedure, the implemen@!tation is allowed to impose |
| 563 |
implementation-defined restrictions on the |
| 564 |
corresponding @nt{protected_@!type_@!declaration} and @nt{protected_@!body}. |
| 565 |
@begin{Ramification} |
| 566 |
The restrictions may be on the constructs that are allowed within them, |
| 567 |
and on ordinary calls (i.e. not via interrupts) on protected operations in |
| 568 |
these protected objects. |
| 569 |
@end{Ramification} |
| 570 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2], |
| 571 |
New=[Any restrictions on a protected procedure or its containing type when |
| 572 |
a @nt{pragma} Attach_handler or Interrupt_Handler applies.],Old=[]}]} |
| 573 |
|
| 574 |
An implementation may use a different mechanism for invoking a protected |
| 575 |
procedure in response to a hardware interrupt than is used for a call |
| 576 |
to that protected procedure from a task. |
| 577 |
@begin{Discussion} |
| 578 |
This is despite the fact that the priority of an interrupt handler |
| 579 |
(see @RefSecNum{Task Priorities}) is modeled after a hardware task calling the |
| 580 |
handler. |
| 581 |
@end{Discussion} |
| 582 |
|
| 583 |
@Defn{notwithstanding} |
| 584 |
Notwithstanding what this subclause says elsewhere, |
| 585 |
the Attach_Handler and Interrupt_Handler pragmas are allowed to be used |
| 586 |
for other, implementation defined, forms of interrupt handlers. |
| 587 |
@begin{Ramification} |
| 588 |
For example, if an implementation wishes to allow interrupt |
| 589 |
handlers to have parameters, it is allowed to do so via these pragmas; |
| 590 |
it need not invent implementation-defined pragmas for the purpose. |
| 591 |
@end{Ramification} |
| 592 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2], |
| 593 |
New=[Any other forms of interrupt handler supported by the |
| 594 |
Attach_Handler and Interrupt_Handler pragmas.],Old=[]}]} |
| 595 |
|
| 596 |
@end{ImplPerm} |
| 597 |
|
| 598 |
@begin{ImplAdvice} |
| 599 |
|
| 600 |
Whenever possible, the implementation should allow interrupt handlers to be |
| 601 |
called directly by the hardware. |
| 602 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 603 |
Text=[Interrupt handlers should be called directly by the hardware.]}]} |
| 604 |
|
| 605 |
Whenever practical, the implementation should |
| 606 |
detect violations of any implementation-defined restrictions |
| 607 |
before run time. |
| 608 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 609 |
Text=[Violations of any implementation-defined restrictions on interrupt |
| 610 |
handlers should be detected before run time.]}]} |
| 611 |
|
| 612 |
@end{ImplAdvice} |
| 613 |
|
| 614 |
@begin{Notes} |
| 615 |
|
| 616 |
The Attach_Handler pragma can provide static attachment of handlers to |
| 617 |
interrupts if the implementation supports preelaboration of protected |
| 618 |
objects. (See @RefSecNum{Preelaboration Requirements}.) |
| 619 |
|
| 620 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 621 |
@Chg{Version=[2],New=[A],Old=[The ceiling priority of a]} |
| 622 |
protected object that |
| 623 |
@Chg{Version=[2],New=[has a (protected) procedure], |
| 624 |
Old=[one of its procedures is]} |
| 625 |
attached to an interrupt should |
| 626 |
@Chg{Version=[2],New=[have a ceiling priority], |
| 627 |
Old=[be]} at least as high as the highest |
| 628 |
processor priority at which that interrupt will ever be delivered. |
| 629 |
|
| 630 |
Protected procedures can also be attached dynamically to interrupts |
| 631 |
via operations declared in the predefined package Interrupts. |
| 632 |
|
| 633 |
An example of a possible implementation-defined restriction is |
| 634 |
disallowing the use of the standard storage pools within the body of |
| 635 |
a protected procedure that is an interrupt handler. |
| 636 |
|
| 637 |
@end{Notes} |
| 638 |
|
| 639 |
@begin{Incompatible95} |
| 640 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00253-01]} |
| 641 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 642 |
@b[Amendment Correction:] Corrected the wording so that the rules for the |
| 643 |
use of Attach_Handler and Interrupt_Handler are identical. This means |
| 644 |
that uses of pragma Interrupt_Handler outside of the target protected type |
| 645 |
or single protected object are now illegal.]} |
| 646 |
@end{Incompatible95} |
| 647 |
|
| 648 |
@begin{DiffWord95} |
| 649 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0068],ARef=[AI95-00121-01]} |
| 650 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified the meaning of |
| 651 |
@lquotes@;the previous handler@rquotes when finalizing protected objects |
| 652 |
containing interrupt handlers.]} |
| 653 |
|
| 654 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00303-01]} |
| 655 |
@ChgAdded{Version=[2],Text=[Dropped the requirement that an object of a |
| 656 |
type containing an Interrupt_Handler pragma must be declared at the library |
| 657 |
level. This was a generic contract model violation. This change is not |
| 658 |
an extension, as an attempt to attach such a handler with a routine in |
| 659 |
package Interrupts will fail an accessibility check anyway. Moreover, |
| 660 |
implementations can retain the rule as an implementation-defined |
| 661 |
restriction on the use of the type, as permitted by the @ImplPermTitle |
| 662 |
above.]} |
| 663 |
@end{Diffword95} |
| 664 |
|
| 665 |
|
| 666 |
@LabeledSubClause{The Package Interrupts} |
| 667 |
|
| 668 |
@begin{StaticSem} |
| 669 |
|
| 670 |
@Leading@Keepnext@;The following language-defined packages exist: |
| 671 |
@begin{example} |
| 672 |
@key{with} System;@ChildUnit{Parent=[Ada],Child=[Interrupts]} |
| 673 |
@key[package] Ada.Interrupts @key[is] |
| 674 |
@key[type] @AdaTypeDefn{Interrupt_ID} @key[is] @RI{implementation-defined}; |
| 675 |
@key[type] @AdaTypeDefn{Parameterless_Handler} @key[is] |
| 676 |
@key[access] @key[protected] @key[procedure]; |
| 677 |
|
| 678 |
@ChgRef{Version=[1], Kind=[Deleted]} |
| 679 |
@Chg[New=<>,Old=<@ @;@comment{Empty paragraph to hang junk paragraph number from original RM}>] |
| 680 |
|
| 681 |
@key[function] @AdaSubDefn{Is_Reserved} (Interrupt : Interrupt_ID) |
| 682 |
@key[return] Boolean; |
| 683 |
|
| 684 |
@key[function] @AdaSubDefn{Is_Attached} (Interrupt : Interrupt_ID) |
| 685 |
@key[return] Boolean; |
| 686 |
|
| 687 |
@key[function] @AdaSubDefn{Current_Handler} (Interrupt : Interrupt_ID) |
| 688 |
@key[return] Parameterless_Handler; |
| 689 |
|
| 690 |
@key[procedure] @AdaSubDefn{Attach_Handler} |
| 691 |
(New_Handler : @key[in] Parameterless_Handler; |
| 692 |
Interrupt : @key[in] Interrupt_ID); |
| 693 |
|
| 694 |
@key[procedure] @AdaSubDefn{Exchange_Handler} |
| 695 |
(Old_Handler : @key[out] Parameterless_Handler; |
| 696 |
New_Handler : @key[in] Parameterless_Handler; |
| 697 |
Interrupt : @key[in] Interrupt_ID); |
| 698 |
|
| 699 |
@key[procedure] @AdaSubDefn{Detach_Handler} |
| 700 |
(Interrupt : @key[in] Interrupt_ID); |
| 701 |
|
| 702 |
@key[function] @AdaSubDefn{Reference}(Interrupt : Interrupt_ID) |
| 703 |
@key{return} System.Address; |
| 704 |
|
| 705 |
@key[private] |
| 706 |
... -- @RI{not specified by the language} |
| 707 |
@key[end] Ada.Interrupts; |
| 708 |
|
| 709 |
|
| 710 |
@key[package] Ada.Interrupts.Names @key[is]@ChildUnit{Parent=[Ada.Interrupts],Child=[Names]} |
| 711 |
@RI{implementation-defined} : @key[constant] Interrupt_ID := |
| 712 |
@RI{implementation-defined}; |
| 713 |
. . . |
| 714 |
@RI{implementation-defined} : @key[constant] Interrupt_ID := |
| 715 |
@RI{implementation-defined}; |
| 716 |
@key[end] Ada.Interrupts.Names; |
| 717 |
@end{example} |
| 718 |
|
| 719 |
@end{StaticSem} |
| 720 |
|
| 721 |
@begin{RunTime} |
| 722 |
|
| 723 |
The Interrupt_ID type is an implementation-defined discrete type used to |
| 724 |
identify interrupts. |
| 725 |
|
| 726 |
The Is_Reserved function returns True if and only if the specified |
| 727 |
interrupt is reserved. |
| 728 |
|
| 729 |
The Is_Attached function returns True if and only if a user-specified |
| 730 |
interrupt handler is attached to the interrupt. |
| 731 |
|
| 732 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0069],ARef=[AI95-00166-01]} |
| 733 |
The Current_Handler function returns a value that represents the |
| 734 |
attached handler of the interrupt. If no user-defined handler is attached to |
| 735 |
the interrupt, Current_Handler returns @Chg{New=[@key{null}], |
| 736 |
Old=[a value that designates the default treatment; calling Attach_Handler |
| 737 |
or Exchange_Handler with this value restores the default treatment]}. |
| 738 |
|
| 739 |
The Attach_Handler procedure attaches the specified handler to the |
| 740 |
interrupt, overriding any existing treatment (including a user handler) |
| 741 |
in effect for that interrupt. |
| 742 |
If New_Handler is @key[null], the default treatment is restored. |
| 743 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of run-time check)} |
| 744 |
If New_Handler designates a protected procedure to which the pragma |
| 745 |
Interrupt_@!Handler does not apply, Program_Error is raised. In |
| 746 |
this case, the operation does not modify the existing interrupt treatment. |
| 747 |
|
| 748 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0069],ARef=[AI95-00166-01]} |
| 749 |
The Exchange_Handler procedure operates in the same manner as Attach_Handler |
| 750 |
with the addition that the value returned in Old_Handler designates the |
| 751 |
previous treatment for the specified interrupt.@Chg{New=[ If the previous |
| 752 |
treatment is not a user-defined handler, @key[null] is returned.],Old=[]} |
| 753 |
@begin{Ramification} |
| 754 |
Calling Attach_Handler or Exchange_Handler with this value for New_Handler |
| 755 |
restores the previous handler. |
| 756 |
|
| 757 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0069],ARef=[AI95-00166-01]} |
| 758 |
@ChgAdded{Version=[1],Text=[If the application uses only parameterless procedures as |
| 759 |
handlers (other types of handlers may be provided by the implementation, but are not |
| 760 |
required by the standard), then if Old_Handler is not @key(null), it may be |
| 761 |
called to execute the previous handler. This provides a way to cascade |
| 762 |
application interrupt handlers. However, the default handler cannot be |
| 763 |
cascaded this way (Old_Handler must be @key(null) for the default handler).]} |
| 764 |
@end{Ramification} |
| 765 |
|
| 766 |
The Detach_Handler procedure restores the default treatment for the |
| 767 |
specified interrupt. |
| 768 |
|
| 769 |
For all operations defined in this package that take a parameter of type |
| 770 |
Interrupt_ID, with the exception of Is_Reserved and Reference, a check is |
| 771 |
made that the specified interrupt is not reserved. |
| 772 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of run-time check)} |
| 773 |
Program_Error is raised if this check fails. |
| 774 |
|
| 775 |
If, by using the Attach_Handler, Detach_Handler, or Exchange_Handler |
| 776 |
procedures, an attempt is made to |
| 777 |
detach a handler that was attached statically (using the pragma |
| 778 |
Attach_Handler), the handler is not detached and Program_Error is |
| 779 |
raised. |
| 780 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of run-time check)} |
| 781 |
|
| 782 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 783 |
The Reference function returns a value of type System.Address that can |
| 784 |
be used to attach a task entry@Chg{Version=[2],New=[],Old=[,]} via an |
| 785 |
address clause (see @RefSecNum{Interrupt Entries}) to the interrupt |
| 786 |
specified by Interrupt. This function raises Program_Error if attaching |
| 787 |
task entries to interrupts (or to this particular interrupt) is not supported. |
| 788 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of run-time check)} |
| 789 |
|
| 790 |
@end{RunTime} |
| 791 |
|
| 792 |
@begin{ImplReq} |
| 793 |
|
| 794 |
At no time during attachment or exchange of handlers shall the current handler |
| 795 |
of the corresponding interrupt be undefined. |
| 796 |
|
| 797 |
@end{ImplReq} |
| 798 |
|
| 799 |
@begin{DocReq} |
| 800 |
|
| 801 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 802 |
If the Ceiling_Locking policy (see @RefSecNum{Priority Ceiling Locking}) is |
| 803 |
in effect@Chg{Version=[2],New=[,],Old=[]} the implementation shall document |
| 804 |
the default ceiling priority |
| 805 |
assigned to a protected object that contains either the Attach_Handler or |
| 806 |
Interrupt_Handler pragmas, but not the Interrupt_Priority pragma. |
| 807 |
@Redundant[This default need not be the same for all interrupts.] |
| 808 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 809 |
Text=[If the Ceiling_Locking policy is in effect, the default ceiling priority |
| 810 |
for a protected object that contains an interrupt handler pragma.]}]} |
| 811 |
|
| 812 |
@end{DocReq} |
| 813 |
|
| 814 |
@begin{ImplAdvice} |
| 815 |
|
| 816 |
If implementation-defined forms of interrupt handler procedures are supported, |
| 817 |
such as protected procedures with parameters, then for each such form of a |
| 818 |
handler, a type analogous to Parameterless_@!Handler should be specified in a |
| 819 |
child package of Interrupts, with the same operations as in the |
| 820 |
predefined package Interrupts. |
| 821 |
|
| 822 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 823 |
Text=[If implementation-defined forms of interrupt handler procedures are |
| 824 |
supported, then for each such form of a |
| 825 |
handler, a type analogous to Parameterless_@!Handler should be specified in a |
| 826 |
child package of Interrupts, with the same operations as in the |
| 827 |
predefined package Interrupts.]}]} |
| 828 |
|
| 829 |
@end{ImplAdvice} |
| 830 |
|
| 831 |
@begin{Notes} |
| 832 |
|
| 833 |
The package Interrupts.Names contains implementation-defined |
| 834 |
names (and constant values) for the interrupts that are supported by |
| 835 |
the implementation. |
| 836 |
|
| 837 |
@end{Notes} |
| 838 |
|
| 839 |
@begin{Examples} |
| 840 |
@Leading@Keepnext@i{Example of interrupt handlers:} |
| 841 |
@begin{example} |
| 842 |
Device_Priority : @key[constant] |
| 843 |
@key[array] (1..5) of System.Interrupt_Priority := ( ... );@Softpage |
| 844 |
@key[protected] @key[type] Device_Interface |
| 845 |
(Int_ID : Ada.Interrupts.Interrupt_ID) @key[is] |
| 846 |
@key[procedure] Handler; |
| 847 |
@key[pragma] Attach_Handler(Handler, Int_ID); |
| 848 |
... |
| 849 |
@key[pragma] Interrupt_Priority(Device_Priority(Int_ID)); |
| 850 |
@key[end] Device_Interface;@Softpage |
| 851 |
... |
| 852 |
Device_1_Driver : Device_Interface(1); |
| 853 |
... |
| 854 |
Device_5_Driver : Device_Interface(5); |
| 855 |
... |
| 856 |
@end{example} |
| 857 |
@end{Examples} |
| 858 |
|
| 859 |
@begin{DiffWord95} |
| 860 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0069],ARef=[AI95-00166-01]} |
| 861 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that the value |
| 862 |
returned by Current_Handler and Exchange_Handler for the default treatment |
| 863 |
is null.]} |
| 864 |
@end{Diffword95} |
| 865 |
|
| 866 |
|
| 867 |
@LabeledClause{Preelaboration Requirements} |
| 868 |
|
| 869 |
@begin{Intro} |
| 870 |
@Redundant[This clause specifies additional implementation and documentation |
| 871 |
requirements for the Preelaborate pragma (see @RefSecNum{Elaboration Control}).] |
| 872 |
@end{Intro} |
| 873 |
|
| 874 |
@begin{ImplReq} |
| 875 |
|
| 876 |
The implementation shall not incur any run-time overhead for the elaboration |
| 877 |
checks of subprograms and @ntf{protected_bodies} declared in preelaborated |
| 878 |
library units. |
| 879 |
|
| 880 |
The implementation shall not execute any memory write operations after |
| 881 |
load time for the elaboration of constant objects |
| 882 |
declared immediately within the |
| 883 |
declarative region of a preelaborated library package, so long as the |
| 884 |
subtype and initial expression (or default initial expressions if |
| 885 |
initialized by default) of the @nt<object_declaration> satisfy the |
| 886 |
following restrictions. |
| 887 |
@Defn{load time} |
| 888 |
The meaning of @i{load time} is implementation defined. |
| 889 |
@begin{Discussion} |
| 890 |
On systems where the image of the partition is initially copied from |
| 891 |
disk to RAM, or from ROM to RAM, prior to starting execution of the |
| 892 |
partition, |
| 893 |
the intention is that @lquotes@;load time@rquotes@; consist of this initial copying |
| 894 |
step. |
| 895 |
On other systems, load time and run time might actually be interspersed. |
| 896 |
@end{Discussion} |
| 897 |
@begin{itemize} |
| 898 |
Any @nt<subtype_mark> denotes a statically constrained subtype, with |
| 899 |
statically constrained subcomponents, if any; |
| 900 |
|
| 901 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00161-01]} |
| 902 |
@ChgAdded{Version=[2],Text=[no @nt{subtype_mark} denotes a controlled type, a |
| 903 |
private type, a private extension, a generic formal private type, a generic |
| 904 |
formal derived type, or a descendant of such a type;]} |
| 905 |
|
| 906 |
@begin{Reason} |
| 907 |
@ChgRef{Version=[2],Kind=[Added]} |
| 908 |
@ChgAdded{Version=[2],Text=[For an |
| 909 |
implementation that uses the registration method of finalization, a |
| 910 |
controlled object will require some code executed to register the object |
| 911 |
at the appropriate point. The other types are those that @i{might} have a |
| 912 |
controlled component. None of these types were allowed in preelaborated |
| 913 |
units in Ada 95. These types are covered by the @ImplAdviceTitle, of course, |
| 914 |
so they should still execute as little code as possible.]} |
| 915 |
@end{Reason} |
| 916 |
|
| 917 |
any @nt<constraint> is a static constraint; |
| 918 |
|
| 919 |
any @nt<allocator> is for an access-to-constant type; |
| 920 |
|
| 921 |
any uses of predefined operators appear only within static expressions; |
| 922 |
|
| 923 |
any @ntf<primaries> that are @nt<name>s, other than @nt<attribute_reference>s |
| 924 |
for the Access or Address attributes, appear only within static expressions; |
| 925 |
@begin{ramification} |
| 926 |
This cuts out @nt<attribute_reference>s that are not static, except for |
| 927 |
Access and Address. |
| 928 |
@end{Ramification} |
| 929 |
|
| 930 |
any @nt<name> that is not part of a static expression is an expanded |
| 931 |
name or @nt<direct_name> that statically denotes some entity; |
| 932 |
@begin{Ramification} |
| 933 |
This cuts out @nt<function_call>s and @nt<type_conversion>s that are not |
| 934 |
static, including calls on attribute functions like 'Image and 'Value. |
| 935 |
@end{Ramification} |
| 936 |
|
| 937 |
any @nt<discrete_choice> of an @nt<array_aggregate> is static; |
| 938 |
|
| 939 |
no language-defined check associated with the elaboration of the |
| 940 |
@nt<object_declaration> can fail. |
| 941 |
@begin{Reason} |
| 942 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]} |
| 943 |
The intent is that aggregates all of whose scalar subcomponents are static@Chg{Version=[2],New=[],Old=[,]} |
| 944 |
and all of whose access subcomponents are @key(null), allocators for |
| 945 |
access-to-constant types, or X'Access, will be supported with no run-time |
| 946 |
code generated. |
| 947 |
@end{Reason} |
| 948 |
@end{itemize} |
| 949 |
|
| 950 |
@end{ImplReq} |
| 951 |
|
| 952 |
@begin{DocReq} |
| 953 |
|
| 954 |
The implementation shall document any circumstances under which the |
| 955 |
elaboration of a preelaborated package causes code to be executed at run time. |
| 956 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 957 |
Text=[Any circumstances when the elaboration of a preelaborated package |
| 958 |
causes code to be executed.]}]} |
| 959 |
|
| 960 |
The implementation shall document whether the method used for initialization |
| 961 |
of preelaborated variables allows a partition to be restarted without |
| 962 |
reloading. |
| 963 |
@ChgDocReq{Version=[2],Kind=[Added],Text=[@ChgAdded{Version=[2], |
| 964 |
Text=[Whether a partition can be restarted without reloading.]}]} |
| 965 |
@ChgImplDef{Version=[2],Kind=[Deleted],Text=[@ChgDeleted{Version=[2], |
| 966 |
Text=[Implementation-defined aspects of preelaboration.]}]} |
| 967 |
@begin{discussion} |
| 968 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]} |
| 969 |
This covers the issue of the @Chg{Version=[2],New=[run-time system],Old=[RTS]} |
| 970 |
itself being restartable, |
| 971 |
so that need not be a separate @DocReqName. |
| 972 |
@end{discussion} |
| 973 |
|
| 974 |
@end{DocReq} |
| 975 |
|
| 976 |
@begin{ImplAdvice} |
| 977 |
|
| 978 |
It is recommended that preelaborated packages be implemented in such a |
| 979 |
way that there should be little or no code executed at run time for the |
| 980 |
elaboration of entities not already covered by the @ImplReqName@;s. |
| 981 |
|
| 982 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 983 |
Text=[Preelaborated packages should be implemented such that little or no |
| 984 |
code is executed at run time for the elaboration of entities.]}]} |
| 985 |
@end{ImplAdvice} |
| 986 |
|
| 987 |
@begin{DiffWord95} |
| 988 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00161-01]} |
| 989 |
@ChgAdded{Version=[2],Text=[Added wording to exclude the additional kinds |
| 990 |
of types allowed in preelaborated units from the @ImplReqTitle.]} |
| 991 |
@end{DiffWord95} |
| 992 |
|
| 993 |
|
| 994 |
@LabeledClause{Pragma Discard_Names} |
| 995 |
|
| 996 |
@begin{Intro} |
| 997 |
@Redundant[A @nt{pragma} Discard_Names may be used to request a |
| 998 |
reduction in storage used for the names of certain entities.] |
| 999 |
@end{Intro} |
| 1000 |
|
| 1001 |
@begin{Syntax} |
| 1002 |
@begin{SyntaxText} |
| 1003 |
@Leading@Keepnext@;The form of a @nt{pragma} Discard_Names is as follows: |
| 1004 |
@end{SyntaxText} |
| 1005 |
|
| 1006 |
@PragmaSyn`@key{pragma} @prag(Discard_Names)[([On => ] @Syn2[local_name])];' |
| 1007 |
|
| 1008 |
@begin{SyntaxText} |
| 1009 |
A @nt{pragma} Discard_Names is allowed only immediately within a |
| 1010 |
@nt{declarative_part}, immediately within a @nt{package_specification}, |
| 1011 |
or as a configuration pragma. |
| 1012 |
@PDefn2{Term=[configuration pragma], Sec=(Discard_Names)} |
| 1013 |
@PDefn2{Term=[pragma, configuration], Sec=(Discard_Names)} |
| 1014 |
@end{SyntaxText} |
| 1015 |
@end{Syntax} |
| 1016 |
|
| 1017 |
@begin{Legality} |
| 1018 |
The @nt{local_name} (if present) shall denote a non-derived |
| 1019 |
enumeration @Redundant[first] subtype, |
| 1020 |
a tagged @Redundant[first] subtype, or an exception. |
| 1021 |
The pragma applies to the type or exception. |
| 1022 |
Without a @nt{local_name}, the pragma applies to all such entities |
| 1023 |
declared after the pragma, within the same declarative region. |
| 1024 |
Alternatively, the pragma can be used as a configuration pragma. |
| 1025 |
If the pragma applies to a type, |
| 1026 |
then it applies also to all descendants of the type. |
| 1027 |
@end{Legality} |
| 1028 |
|
| 1029 |
@begin{StaticSem} |
| 1030 |
@PDefn2{Term=[representation pragma], Sec=(Discard_Names)} |
| 1031 |
@PDefn2{Term=[pragma, representation], Sec=(Discard_Names)} |
| 1032 |
If a @nt{local_name} is given, then |
| 1033 |
a @nt{pragma} Discard_Names is a representation pragma. |
| 1034 |
|
| 1035 |
|
| 1036 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00400-01]} |
| 1037 |
If the pragma applies to an enumeration type, |
| 1038 |
then the semantics of the @Chg{Version=[2],New=[Wide_Wide_Image],Old=[Wide_Image]} |
| 1039 |
and @Chg{Version=[2],New=[Wide_Wide_Value],Old=[Wide_Value]} attributes |
| 1040 |
are implementation defined for that type@Redundant[; the |
| 1041 |
semantics of Image@Chg{Version=[2],New=[, Wide_Image,],Old=[ and]} |
| 1042 |
Value@Chg{Version=[2],New=[, and Wide_Value],Old=[]} are still defined in |
| 1043 |
terms of @Chg{Version=[2],New=[Wide_Wide_Image],Old=[Wide_Image]} |
| 1044 |
and @Chg{Version=[2],New=[Wide_Wide_Value],Old=[Wide_Value]}]. |
| 1045 |
In addition, the semantics of Text_IO.Enumeration_IO are implementation |
| 1046 |
defined. |
| 1047 |
If the pragma applies to a tagged type, |
| 1048 |
then the semantics of the Tags.@!@Chg{Version=[2],New=[Wide_Wide_@!Expanded_@!Name], |
| 1049 |
Old=[Expanded_@!Name]} function |
| 1050 |
are implementation defined for that type@Chg{Version=[2],New=[@Redundant[; the |
| 1051 |
semantics of Tags.@!Expanded_@!Name and Tags.@!Wide_@!Expanded_@!Name are still |
| 1052 |
defined in terms of Tags.@!Wide_Wide_@!Expanded_@!Name]], Old=[]}. |
| 1053 |
If the pragma applies to an exception, |
| 1054 |
then the semantics of the Exceptions.@!@Chg{Version=[2],New=[Wide_Wide_@!Exception_@!Name], |
| 1055 |
Old=[Exception_@!Name]} function |
| 1056 |
are implementation defined for that exception@Chg{Version=[2],New=[@Redundant[; the |
| 1057 |
semantics of Exceptions.@!Exception_@!Name and Exceptions.@!Wide_@!Exception_@!Name |
| 1058 |
are still defined in terms of Exceptions.@!Wide_Wide_@!Exception_@!Name]], Old=[]}. |
| 1059 |
|
| 1060 |
@ImplDef{The semantics of pragma Discard_Names.} |
| 1061 |
@begin{Ramification} |
| 1062 |
The Width attribute is still defined in terms of Image. |
| 1063 |
|
| 1064 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 1065 |
The semantics of S'@Chg{Version=[2],New=[Wide_Wide_Image],Old=[Wide_Image]} |
| 1066 |
and S'@Chg{Version=[2],New=[Wide_Wide_Value],Old=[Wide_Value]} are |
| 1067 |
implementation defined for any subtype of an enumeration type to which |
| 1068 |
the pragma applies. (The pragma actually names the first subtype, |
| 1069 |
of course.) |
| 1070 |
@end{Ramification} |
| 1071 |
@end{StaticSem} |
| 1072 |
|
| 1073 |
@begin{ImplAdvice} |
| 1074 |
If the pragma applies to an entity, then the implementation should |
| 1075 |
reduce the amount of storage used for storing names associated with that |
| 1076 |
entity. |
| 1077 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 1078 |
Text=[If @nt{pragma} Discard_Names applies to an entity, then the amount of |
| 1079 |
storage used for storing names associated with that entity should be reduced.]}]} |
| 1080 |
@begin{Reason} |
| 1081 |
A typical implementation of the Image attribute for enumeration types is |
| 1082 |
to store a table containing the names of all the enumeration literals. |
| 1083 |
Pragma Discard_Names allows the implementation to avoid storing such a |
| 1084 |
table without having to prove that the Image attribute is never used |
| 1085 |
(which can be difficult in the presence of separate compilation). |
| 1086 |
|
| 1087 |
We did not specify the semantics of the Image attribute in the presence |
| 1088 |
of this pragma because different semantics might be desirable in |
| 1089 |
different situations. |
| 1090 |
In some cases, it might make sense to use the Image attribute to print |
| 1091 |
out a useful value that can be used to identify the entity given |
| 1092 |
information in compiler-generated listings. |
| 1093 |
In other cases, it might make sense to get an error at compile time or |
| 1094 |
at run time. |
| 1095 |
In cases where memory is plentiful, the simplest implementation makes |
| 1096 |
sense: ignore the pragma. |
| 1097 |
Implementations that are capable of avoiding the extra storage in cases |
| 1098 |
where the Image attribute is never used might also wish to ignore the |
| 1099 |
pragma. |
| 1100 |
|
| 1101 |
The same applies to the Tags.Expanded_Name and Exceptions.Exception_Name |
| 1102 |
functions. |
| 1103 |
@end{Reason} |
| 1104 |
@end{ImplAdvice} |
| 1105 |
|
| 1106 |
@begin{DiffWord95} |
| 1107 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01],ARef=[AI95-00400-01]} |
| 1108 |
@ChgAdded{Version=[2],Text=[Updated the wording to reflect that the double |
| 1109 |
wide image and value functions are now the master versions that the others |
| 1110 |
are defined from.]} |
| 1111 |
@end{DiffWord95} |
| 1112 |
|
| 1113 |
|
| 1114 |
@LabeledClause{Shared Variable Control} |
| 1115 |
|
| 1116 |
@begin{Intro} |
| 1117 |
@Redundant[This clause specifies representation pragmas that control the use of |
| 1118 |
shared variables.] |
| 1119 |
@end{Intro} |
| 1120 |
|
| 1121 |
@begin{Syntax} |
| 1122 |
@begin{SyntaxText} |
| 1123 |
@Leading@;The form for pragmas Atomic, Volatile, Atomic_Components, and |
| 1124 |
Volatile_Components is as follows: |
| 1125 |
@end{SyntaxText} |
| 1126 |
|
| 1127 |
@PragmaSyn`@key{pragma} @prag(Atomic)(@Syn2{local_name});' |
| 1128 |
|
| 1129 |
@PragmaSyn`@key{pragma} @prag(Volatile)(@Syn2{local_name});' |
| 1130 |
|
| 1131 |
@PragmaSyn`@key{pragma} @prag(Atomic_Components)(@SynI{array_}@Syn2{local_name});' |
| 1132 |
|
| 1133 |
@PragmaSyn`@key{pragma} @prag(Volatile_Components)(@SynI{array_}@Syn2{local_name});' |
| 1134 |
|
| 1135 |
@end{Syntax} |
| 1136 |
|
| 1137 |
@begin{Intro} |
| 1138 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00272-01]} |
| 1139 |
@Defn{atomic} |
| 1140 |
An @i{atomic} type is one to which a pragma Atomic applies. |
| 1141 |
An @i{atomic} object (including a component) |
| 1142 |
is one to which a |
| 1143 |
pragma Atomic applies, or a component of an array to which |
| 1144 |
a pragma Atomic_Components applies, or any object of an atomic type@Chg{Version=[2], |
| 1145 |
New=[, other than objects obtained by evaluating a slice],Old=[]}. |
| 1146 |
|
| 1147 |
@begin{Ramification} |
| 1148 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00272-01]} |
| 1149 |
@ChgAdded{Version=[2],Text=[A slice of an atomic array object is not itself |
| 1150 |
atomic. That's necessary as executing a read or write of a dynamic number |
| 1151 |
of components in a single instruction is not possible on many targets.]} |
| 1152 |
@end{Ramification} |
| 1153 |
|
| 1154 |
@Defn{volatile} |
| 1155 |
A @i{volatile} type is one to which a pragma Volatile applies. |
| 1156 |
A @i{volatile} object (including a component) |
| 1157 |
is one to which a pragma Volatile applies, |
| 1158 |
or a component of an array to which a pragma Volatile_@!Components applies, |
| 1159 |
or any object of a volatile type. |
| 1160 |
In addition, every atomic type or object is also defined to be volatile. |
| 1161 |
Finally, if an object is volatile, then so |
| 1162 |
are all of its subcomponents @Redundant[(the same does not apply to atomic)]. |
| 1163 |
@end{Intro} |
| 1164 |
|
| 1165 |
@begin{Resolution} |
| 1166 |
|
| 1167 |
The @nt{local_name} in an Atomic or Volatile pragma shall resolve to denote |
| 1168 |
either an @nt{object_declaration}, a non-inherited @nt{component_@!declaration}, |
| 1169 |
or a @nt{full_type_@!declaration}. The |
| 1170 |
@SynI{array_}@nt{local_name} in an Atomic_@!Components or |
| 1171 |
Volatile_@!Components pragma shall resolve to denote the declaration |
| 1172 |
of an array type or an array object of an anonymous type. |
| 1173 |
|
| 1174 |
@end{Resolution} |
| 1175 |
|
| 1176 |
@begin{Legality} |
| 1177 |
@Defn{indivisible} |
| 1178 |
It is illegal to apply either an Atomic or Atomic_Components pragma to an |
| 1179 |
object or type if the implementation cannot support the indivisible reads |
| 1180 |
and updates required by the pragma (see below). |
| 1181 |
|
| 1182 |
It is illegal to specify the Size attribute of an atomic object, |
| 1183 |
the Component_Size attribute for an array type with atomic |
| 1184 |
components, or the layout attributes of an atomic component, |
| 1185 |
in a way that prevents the implementation from performing the |
| 1186 |
required indivisible reads and updates. |
| 1187 |
|
| 1188 |
If an atomic object is passed as a parameter, then the type of the formal |
| 1189 |
parameter shall either be atomic or allow pass by copy @Redundant[(that |
| 1190 |
is, not be a nonatomic by-reference type)]. If an atomic object is used |
| 1191 |
as an actual for a generic formal object of mode @key{in out}, then the |
| 1192 |
type of the generic formal object shall be atomic. If the @nt<prefix> of |
| 1193 |
an @nt<attribute_reference> for an Access attribute denotes an atomic |
| 1194 |
object @Redundant[(including a component)], then the designated type of |
| 1195 |
the resulting access type shall be atomic. If an atomic type is used as |
| 1196 |
an actual for a generic formal derived type, then the ancestor of the |
| 1197 |
formal type shall be atomic or allow pass by copy. Corresponding rules |
| 1198 |
apply to volatile objects and types. |
| 1199 |
|
| 1200 |
If a pragma Volatile, Volatile_Components, Atomic, or Atomic_Components |
| 1201 |
applies to a stand-alone constant object, then a pragma Import shall |
| 1202 |
also apply to it. |
| 1203 |
@begin{Ramification} |
| 1204 |
Hence, no initialization expression is allowed for such a constant. Note |
| 1205 |
that a constant that is atomic or volatile because of its type is allowed. |
| 1206 |
@end{Ramification} |
| 1207 |
@begin{Reason} |
| 1208 |
Stand-alone constants that are explicitly specified as Atomic or Volatile |
| 1209 |
only make sense if they are being manipulated outside the Ada program. |
| 1210 |
From the Ada perspective the object is read-only. Nevertheless, if |
| 1211 |
imported and atomic or volatile, the implementation should presume it |
| 1212 |
might be altered externally. |
| 1213 |
For an imported stand-alone constant that is not atomic or |
| 1214 |
volatile, the implementation can assume that it will not be |
| 1215 |
altered. |
| 1216 |
@end{Reason} |
| 1217 |
|
| 1218 |
@end{Legality} |
| 1219 |
|
| 1220 |
@begin{StaticSem} |
| 1221 |
|
| 1222 |
@PDefn2{Term=[representation pragma], Sec=(Atomic)} |
| 1223 |
@PDefn2{Term=[pragma, representation], Sec=(Atomic)} |
| 1224 |
@PDefn2{Term=[representation pragma], Sec=(Volatile)} |
| 1225 |
@PDefn2{Term=[pragma, representation], Sec=(Volatile)} |
| 1226 |
@PDefn2{Term=[representation pragma], Sec=(Atomic_Components)} |
| 1227 |
@PDefn2{Term=[pragma, representation], Sec=(Atomic_Components)} |
| 1228 |
@PDefn2{Term=[representation pragma], Sec=(Volatile_Components)} |
| 1229 |
@PDefn2{Term=[pragma, representation], Sec=(Volatile_Components)} |
| 1230 |
These @nt{pragma}s are representation pragmas |
| 1231 |
(see @RefSecNum{Operational and Representation Items}). |
| 1232 |
|
| 1233 |
@end{StaticSem} |
| 1234 |
|
| 1235 |
@begin{RunTime} |
| 1236 |
|
| 1237 |
For an atomic object (including an atomic component) all reads and |
| 1238 |
updates of the object as a whole are indivisible. |
| 1239 |
|
| 1240 |
For a volatile object all reads and updates of the |
| 1241 |
object as a whole are performed directly to memory. |
| 1242 |
@begin{ImplNote} |
| 1243 |
This precludes any use of register temporaries, caches, and other |
| 1244 |
similar optimizations for that object. |
| 1245 |
@end{ImplNote} |
| 1246 |
|
| 1247 |
@Defn2{Term=[sequential], Sec=(actions)} |
| 1248 |
Two actions are sequential (see @RefSecNum{Shared Variables}) if each |
| 1249 |
is the read or update of the same atomic object. |
| 1250 |
|
| 1251 |
@PDefn2{Term=[by-reference type], Sec=(atomic or volatile)} |
| 1252 |
If a type is atomic or volatile and it is not a by-copy type, then the type |
| 1253 |
is defined to be a by-reference type. If any subcomponent of a type is |
| 1254 |
atomic or volatile, then the type is defined to be a by-reference type. |
| 1255 |
|
| 1256 |
If an actual parameter is atomic or volatile, and the corresponding |
| 1257 |
formal parameter is not, then the parameter is passed by copy. |
| 1258 |
@begin{ImplNote} |
| 1259 |
Note that in the case where such a parameter is normally passed by |
| 1260 |
reference, a copy of the actual will have to be produced at the call-site, |
| 1261 |
and a pointer to the copy passed to the formal parameter. If the actual |
| 1262 |
is atomic, any copying has to use indivisible read on the way in, and |
| 1263 |
indivisible write on the way out. |
| 1264 |
@end{ImplNote} |
| 1265 |
@begin{Reason} |
| 1266 |
It has to be known at compile time whether an atomic or a volatile parameter |
| 1267 |
is to be passed by copy or by reference. For some types, it is unspecified |
| 1268 |
whether parameters are passed by copy or by reference. The above rules |
| 1269 |
further specify the parameter passing rules involving atomic and volatile |
| 1270 |
types and objects. |
| 1271 |
@end{Reason} |
| 1272 |
|
| 1273 |
@end{RunTime} |
| 1274 |
|
| 1275 |
@begin{ImplReq} |
| 1276 |
|
| 1277 |
@PDefn2{Term=[external effect], Sec=(volatile/atomic objects)} |
| 1278 |
The external effect of a program |
| 1279 |
(see @RefSecNum(Conformity of an Implementation with the Standard)) |
| 1280 |
is defined to include each read and update |
| 1281 |
of a volatile or atomic object. The implementation shall not |
| 1282 |
generate any memory reads or updates of atomic or volatile |
| 1283 |
objects other than those specified by the program. |
| 1284 |
@begin{Discussion} |
| 1285 |
The presumption is that volatile or atomic objects might reside in an |
| 1286 |
@lquotes@;active@rquotes@; part of the address space where each read has a potential |
| 1287 |
side-effect, and at the very least might deliver a different value. |
| 1288 |
|
| 1289 |
@Leading@;The rule above and the definition of external effect are intended to |
| 1290 |
prevent (at least) the following incorrect optimizations, where V is |
| 1291 |
a volatile variable: |
| 1292 |
@begin{itemize} |
| 1293 |
X:= V; Y:=V; cannot be allowed to be translated as Y:=V; X:=V; |
| 1294 |
|
| 1295 |
Deleting redundant loads: X:= V; X:= V; shall read the value of V from |
| 1296 |
memory twice. |
| 1297 |
|
| 1298 |
Deleting redundant stores: V:= X; V:= X; shall write into V twice. |
| 1299 |
|
| 1300 |
Extra stores: V:= X+Y; should not translate to something like V:= X; V:= V+Y; |
| 1301 |
|
| 1302 |
Extra loads: X:= V; Y:= X+Z; X:=X+B; should not translate to something like |
| 1303 |
Y:= V+Z; X:= V+B; |
| 1304 |
|
| 1305 |
Reordering of loads from volatile variables: X:= V1; Y:= V2; (whether or not |
| 1306 |
V1 = V2) should not translate to Y:= V2; X:= V1; |
| 1307 |
|
| 1308 |
Reordering of stores to volatile variables: V1:= X; V2:= X; should not |
| 1309 |
translate to V2:=X; V1:= X; |
| 1310 |
@end{itemize} |
| 1311 |
@end{Discussion} |
| 1312 |
|
| 1313 |
If a pragma Pack applies to a type any of whose subcomponents are atomic, |
| 1314 |
the implementation shall not pack the atomic subcomponents more tightly |
| 1315 |
than that for which it can support indivisible reads and updates. |
| 1316 |
@begin{ImplNote} |
| 1317 |
A warning might be appropriate if no packing whatsoever can be achieved. |
| 1318 |
@end{ImplNote} |
| 1319 |
|
| 1320 |
@end{ImplReq} |
| 1321 |
|
| 1322 |
@begin{ImplAdvice} |
| 1323 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00259-01]} |
| 1324 |
@ChgAdded{Version=[2],Text=[A load or store of a volatile object whose size is |
| 1325 |
a multiple of System.Storage_Unit and whose alignment is nonzero, should be |
| 1326 |
implemented by accessing exactly the bits of the object and no others.]} |
| 1327 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 1328 |
Text=[A load or store of a volatile object whose size is |
| 1329 |
a multiple of System.Storage_Unit and whose alignment is nonzero, should be |
| 1330 |
implemented by accessing exactly the bits of the object and no others.]}]} |
| 1331 |
|
| 1332 |
@begin{Reason} |
| 1333 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1334 |
@ChgAdded{Version=[2],Text=[Since any object can be a volatile object, |
| 1335 |
including packed array components and bit-mapped record components, we |
| 1336 |
require the above only when it is reasonable to assume that the machine |
| 1337 |
can avoid accessing bits outside of the object.]} |
| 1338 |
@end{Reason} |
| 1339 |
|
| 1340 |
@begin{Ramification} |
| 1341 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1342 |
@ChgAdded{Version=[2],Text=[This implies that the load or store of a |
| 1343 |
volatile object that meets the above requirement should not be combined |
| 1344 |
with that of any other object, nor should it access any bits not |
| 1345 |
belonging to any other object. This means that the suitability of the |
| 1346 |
implementation for memory-mapped I/O can be determined from its |
| 1347 |
documentation, as any cases where the implementation does not follow |
| 1348 |
@ImplAdviceTitle must be documented.]} |
| 1349 |
@end{Ramification} |
| 1350 |
|
| 1351 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00259-01]} |
| 1352 |
@ChgAdded{Version=[2],Text=[A load or store of an atomic object should, where |
| 1353 |
possible, be implemented by a single load or store instruction.]} |
| 1354 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 1355 |
Text=[A load or store of an atomic object should be implemented by a single |
| 1356 |
load or store instruction.]}]} |
| 1357 |
|
| 1358 |
@end{ImplAdvice} |
| 1359 |
|
| 1360 |
@begin{Notes} |
| 1361 |
|
| 1362 |
An imported volatile or atomic constant behaves as a constant (i.e. |
| 1363 |
read-only) with respect to other parts of the Ada program, but can |
| 1364 |
still be modified by an @lquotes@;external source.@rquotes@; |
| 1365 |
|
| 1366 |
@end{Notes} |
| 1367 |
|
| 1368 |
@begin{Incompatible83} |
| 1369 |
@Defn{incompatibilities with Ada 83} |
| 1370 |
Pragma Atomic replaces Ada 83's pragma Shared. |
| 1371 |
The name @lquotes@;Shared@rquotes@; was confusing, |
| 1372 |
because the pragma was not used to mark variables as shared. |
| 1373 |
@end{Incompatible83} |
| 1374 |
|
| 1375 |
@begin{DiffWord95} |
| 1376 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00259-01]} |
| 1377 |
@ChgAdded{Version=[2],Text=[Added @ImplAdviceTitle to clarify the meaning |
| 1378 |
of Atomic and Volatile in machine terms. The documentation that this |
| 1379 |
advice applies will make the use of Ada implementations more predictable |
| 1380 |
for low-level (such as device register) programming.]} |
| 1381 |
|
| 1382 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00272-01]} |
| 1383 |
@ChgAdded{Version=[2],Text=[Added wording to clarify that a slice of an |
| 1384 |
object of an atomic type is not atomic, just like a component of an atomic |
| 1385 |
type is not (necessarily) atomic.]} |
| 1386 |
@end{Diffword95} |
| 1387 |
|
| 1388 |
|
| 1389 |
@LabeledRevisedClause{Version=[2],New=[Task Information], |
| 1390 |
Old=[Task Identification and Attributes]} |
| 1391 |
|
| 1392 |
@begin{Intro} |
| 1393 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00266-02]} |
| 1394 |
@Redundant[This clause describes operations and attributes that can be |
| 1395 |
used to obtain the identity of a task. In addition, |
| 1396 |
a package that associates user-defined information with a task is |
| 1397 |
defined.@Chg{Version=[2],New=[ Finally, a package that associates |
| 1398 |
termination procedures with a task or set of tasks is defined.],Old=[]}] |
| 1399 |
@end{Intro} |
| 1400 |
|
| 1401 |
@begin{DiffWord95} |
| 1402 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 1403 |
@ChgAdded{Version=[2],Text=[The title and text here were updated to reflect |
| 1404 |
the addition of task termination procedures to this clause.]} |
| 1405 |
@end{DiffWord95} |
| 1406 |
|
| 1407 |
@LabeledSubClause{The Package Task_Identification} |
| 1408 |
|
| 1409 |
@begin{StaticSem} |
| 1410 |
@Leading@Keepnext@;The following language-defined library package exists: |
| 1411 |
@begin{example} |
| 1412 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00362-01]} |
| 1413 |
@key[package] Ada.Task_Identification @key[is]@ChildUnit{Parent=[Ada],Child=[Task_Identification]}@Chg{Version=[2],New=[ |
| 1414 |
@key[pragma] Preelaborate(Task_Identification);],Old=[]} |
| 1415 |
@key[type] @AdaTypeDefn{Task_Id} @key[is] @key{private};@Chg{Version=[2],New=[ |
| 1416 |
@key[pragma] Preelaborable_Initialization (Task_Id);],Old=[]} |
| 1417 |
@AdaSubDefn{Null_Task_Id} : @key{constant} Task_Id; |
| 1418 |
@key{function} "=" (Left, Right : Task_Id) @key{return} Boolean; |
| 1419 |
|
| 1420 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0070],ARef=[AI95-00101-01]} |
| 1421 |
@key{function} @AdaSubDefn{Image} (T : Task_Id) @key{return} String; |
| 1422 |
@key[function] @AdaSubDefn{Current_Task} @key[return] Task_Id; |
| 1423 |
@Key[procedure] @AdaSubDefn{Abort_Task} (T : @key[in] @Chg{New=[],Old=[@key[out] ]}Task_Id); |
| 1424 |
|
| 1425 |
@key[function] @AdaSubDefn{Is_Terminated}(T : Task_Id) @key{return} Boolean; |
| 1426 |
@key[function] @AdaSubDefn{Is_Callable} (T : Task_Id) @key{return} Boolean; |
| 1427 |
@key[private] |
| 1428 |
... -- @RI{not specified by the language} |
| 1429 |
@key[end] Ada.Task_Identification; |
| 1430 |
@end{example} |
| 1431 |
@end{StaticSem} |
| 1432 |
|
| 1433 |
@begin{RunTime} |
| 1434 |
|
| 1435 |
A value of the type Task_Id identifies an existent task. The constant |
| 1436 |
Null_Task_Id does not identify any task. Each object of the type Task_Id |
| 1437 |
is default initialized to the value of Null_Task_Id. |
| 1438 |
|
| 1439 |
The function "=" returns True if and only if Left and Right identify the same |
| 1440 |
task or both have the value Null_Task_Id. |
| 1441 |
|
| 1442 |
The function Image returns an implementation-defined string that identifies |
| 1443 |
T. If T equals Null_Task_Id, Image returns an empty string. |
| 1444 |
@ImplDef{The result of the Task_Identification.Image attribute.} |
| 1445 |
|
| 1446 |
The function Current_Task returns a value that identifies the calling task. |
| 1447 |
|
| 1448 |
The effect of Abort_Task is the same as the @nt{abort_statement} for the |
| 1449 |
task identified by T. @Redundant[In addition, if T identifies the |
| 1450 |
environment task, the entire partition is aborted, See @RefSecNum{Partitions}.] |
| 1451 |
|
| 1452 |
The functions Is_Terminated and Is_Callable return the value of the |
| 1453 |
corresponding attribute of the task identified by T. |
| 1454 |
@begin{Ramification} |
| 1455 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0115],ARef=[AI95-00206-01]} |
| 1456 |
@ChgAdded{Version=[1],Text=[These routines can be called with an argument |
| 1457 |
identifying the environment task. Is_Terminated will always be False for such a |
| 1458 |
call, but Is_Callable (usually True) could be False if the environment task is |
| 1459 |
waiting for the termination of dependent tasks. Thus, a dependent task can use |
| 1460 |
Is_Callable to determine if the main subprogram has completed.]} |
| 1461 |
@end{Ramification} |
| 1462 |
|
| 1463 |
@Leading@;For @PrefixType{a @nt<prefix> T that is of a task type |
| 1464 |
@Redundant[(after any implicit dereference)]}, |
| 1465 |
the following attribute is defined: |
| 1466 |
@begin{Description} |
| 1467 |
|
| 1468 |
@Attribute{Prefix=<T>, AttrName=<Identity>, |
| 1469 |
Text=[Yields a value of the type Task_Id that identifies |
| 1470 |
the task denoted by T.]} |
| 1471 |
|
| 1472 |
@end{Description} |
| 1473 |
@EndPrefixType{} |
| 1474 |
|
| 1475 |
@Leading@;For @PrefixType{a @nt<prefix> E that denotes an |
| 1476 |
@nt<entry_declaration>}, |
| 1477 |
the following attribute is defined: |
| 1478 |
@begin{Description} |
| 1479 |
@Attribute{Prefix=<E>, AttrName=<Caller>, |
| 1480 |
Text=[Yields a value of the type Task_Id that identifies the task |
| 1481 |
whose call is now being serviced. Use of this attribute is |
| 1482 |
allowed only inside an @nt{entry_body} or @nt{accept_statement} |
| 1483 |
corresponding to the @nt{entry_declaration} denoted by E.]} |
| 1484 |
@end{Description} |
| 1485 |
@EndPrefixType{} |
| 1486 |
|
| 1487 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of run-time check)} |
| 1488 |
Program_Error is raised if a value of Null_Task_Id is passed |
| 1489 |
as a parameter to Abort_Task, Is_Terminated, and Is_Callable. |
| 1490 |
|
| 1491 |
@PDefn2{Term=[potentially blocking operation],Sec=(Abort_Task)} |
| 1492 |
@PDefn2{Term=[blocking, potentially],Sec=(Abort_Task)} |
| 1493 |
Abort_Task is a potentially blocking operation |
| 1494 |
(see @RefSecNum{Protected Subprograms and Protected Actions}). |
| 1495 |
@end{RunTime} |
| 1496 |
|
| 1497 |
@begin{Bounded} |
| 1498 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00237-01]} |
| 1499 |
@PDefn2{Term=(bounded error),Sec=(cause)} |
| 1500 |
It is a bounded error to call the Current_Task function from |
| 1501 |
an entry body@Chg{Version=[2],New=[,],Old=[ or an]} interrupt handler@Chg{Version=[2], |
| 1502 |
New=[, or finalization of a task attribute],Old=[]}. |
| 1503 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of run-time check)} |
| 1504 |
Program_Error is raised, or an implementation-defined value of the type |
| 1505 |
Task_Id is returned. |
| 1506 |
@ChgImplDef{Version=[2],Kind=[Revised],Text=[The value of Current_Task when in |
| 1507 |
a protected entry@Chg{Version=[2],New=[,],Old=[ or]} interrupt handler@Chg{Version=[2], |
| 1508 |
New=[, or finalization of a task attribute],Old=[]}.]} |
| 1509 |
@begin{ImplNote} |
| 1510 |
This value could be Null_Task_Id, or the ID of some user task, or that of |
| 1511 |
an internal task created by the implementation. |
| 1512 |
@end{ImplNote} |
| 1513 |
@begin{Ramification} |
| 1514 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00237-01]}@Comment{This really should reference AI05-0004, but we don't have that yet. And that hasn't been approved, either} |
| 1515 |
@ChgAdded{Version=[2],Text=[An entry barrier is syntactically part of an |
| 1516 |
@nt{entry_body}, so a call to Current_Task from an entry barrier is also |
| 1517 |
covered by this rule.]} |
| 1518 |
@end{Ramification} |
| 1519 |
|
| 1520 |
@end{Bounded} |
| 1521 |
|
| 1522 |
@begin{Erron} |
| 1523 |
@PDefn2{Term=(erroneous execution),Sec=(cause)} |
| 1524 |
If a value of Task_Id is passed as a parameter to any of the operations |
| 1525 |
declared in this package (or any language-defined child of this |
| 1526 |
package), and the corresponding task object no longer exists, |
| 1527 |
the execution of the program is erroneous. |
| 1528 |
@end{Erron} |
| 1529 |
|
| 1530 |
@begin{DocReq} |
| 1531 |
|
| 1532 |
The implementation shall document the effect of calling Current_Task |
| 1533 |
from an entry body or interrupt handler. |
| 1534 |
@ChgImplDef{Version=[2],Kind=[Deleted],Text=[@ChgDeleted{Version=[2], |
| 1535 |
Text=[The effect of calling Current_Task from an |
| 1536 |
entry body or interrupt handler.]}]} |
| 1537 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 1538 |
Text=[The effect of calling Current_Task from an |
| 1539 |
entry body or interrupt handler.]}]} |
| 1540 |
@end{DocReq} |
| 1541 |
|
| 1542 |
@begin{Notes} |
| 1543 |
|
| 1544 |
This package is intended for use in writing user-defined task scheduling |
| 1545 |
packages and constructing server tasks. Current_Task can be used in |
| 1546 |
conjunction with other operations requiring a task as an argument such |
| 1547 |
as Set_Priority (see @RefSecNum{Dynamic Priorities}). |
| 1548 |
|
| 1549 |
The function Current_Task and the attribute Caller can return a |
| 1550 |
Task_Id value that identifies the environment task. |
| 1551 |
|
| 1552 |
@end{Notes} |
| 1553 |
|
| 1554 |
@begin{Extend95} |
| 1555 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00362-01]} |
| 1556 |
@ChgAdded{Version=[2],Text=[Task_Identification is now preelaborated, |
| 1557 |
so it can be used in preelaborated units.]} |
| 1558 |
@end{Extend95} |
| 1559 |
|
| 1560 |
@begin{DiffWord95} |
| 1561 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0070],ARef=[AI95-00101-01]} |
| 1562 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Corrected the mode of the |
| 1563 |
parameter to Abort_Task to @key{in}.]} |
| 1564 |
|
| 1565 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00237-01]} |
| 1566 |
@ChgAdded{Version=[2],Text=[Corrected the wording to include finalization |
| 1567 |
of a task attribute in the bounded error case; we don't want to specify |
| 1568 |
which task does these operations.]} |
| 1569 |
@end{Diffword95} |
| 1570 |
|
| 1571 |
|
| 1572 |
|
| 1573 |
@LabeledSubClause{The Package Task_Attributes} |
| 1574 |
|
| 1575 |
@begin{StaticSem} |
| 1576 |
@Leading@Keepnext@;The following language-defined generic library package exists: |
| 1577 |
@begin{example} |
| 1578 |
@key{with} Ada.Task_Identification; @key{use} Ada.Task_Identification; |
| 1579 |
@key{generic} |
| 1580 |
@key{type} Attribute @key{is} @key{private}; |
| 1581 |
Initial_Value : @key[in] Attribute; |
| 1582 |
@key{package} Ada.Task_Attributes @key{is}@ChildUnit{Parent=[Ada],Child=[Task_Attributes]} |
| 1583 |
|
| 1584 |
@key{type} @AdaTypeDefn{Attribute_Handle} @key{is} @key{access} @key{all} Attribute; |
| 1585 |
|
| 1586 |
@key{function} @AdaSubDefn{Value}(T : Task_Id := Current_Task) |
| 1587 |
@key{return} Attribute; |
| 1588 |
|
| 1589 |
@key{function} @AdaSubDefn{Reference}(T : Task_Id := Current_Task) |
| 1590 |
@key{return} Attribute_Handle; |
| 1591 |
|
| 1592 |
@key{procedure} @AdaSubDefn{Set_Value}(Val : @key[in] Attribute; |
| 1593 |
T : @key[in] Task_Id := Current_Task); |
| 1594 |
@key{procedure} @AdaSubDefn{Reinitialize}(T : @key[in] Task_Id := Current_Task); |
| 1595 |
|
| 1596 |
@key{end} Ada.Task_Attributes; |
| 1597 |
@end{example} |
| 1598 |
|
| 1599 |
@end{StaticSem} |
| 1600 |
|
| 1601 |
@begin{RunTime} |
| 1602 |
|
| 1603 |
When an instance of Task_Attributes is elaborated in |
| 1604 |
a given active partition, an object of the |
| 1605 |
actual type corresponding to the formal type Attribute |
| 1606 |
is implicitly created for each task (of that partition) |
| 1607 |
that exists and is not yet terminated. |
| 1608 |
This object acts as a user-defined attribute of the task. |
| 1609 |
A task created previously |
| 1610 |
in the partition and not yet terminated has this attribute |
| 1611 |
from that point on. Each task subsequently created in the partition |
| 1612 |
will have this attribute when created. In all these cases, the initial value |
| 1613 |
of the given attribute is Initial_Value. |
| 1614 |
|
| 1615 |
The Value operation returns the value of the corresponding attribute of T. |
| 1616 |
|
| 1617 |
The Reference operation returns an access value that designates the |
| 1618 |
corresponding attribute of T. |
| 1619 |
|
| 1620 |
The Set_Value operation performs any finalization on the old value of the |
| 1621 |
attribute of T and assigns Val to that attribute |
| 1622 |
(see @RefSecNum{Assignment Statements} and |
| 1623 |
@RefSecNum{User-Defined Assignment and Finalization}). |
| 1624 |
|
| 1625 |
The effect of the Reinitialize operation is the same as Set_Value where |
| 1626 |
the Val parameter is replaced with Initial_Value. |
| 1627 |
@begin{ImplNote} |
| 1628 |
In most cases, the attribute memory can be reclaimed at this point. |
| 1629 |
@end{ImplNote} |
| 1630 |
|
| 1631 |
@Defn2{Term=[Tasking_Error],Sec=(raised by failure of run-time check)} |
| 1632 |
For all the operations declared in this package, Tasking_Error is raised |
| 1633 |
if the task identified by T is terminated. |
| 1634 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of run-time check)} |
| 1635 |
Program_Error is raised if the value of T is Null_Task_Id. |
| 1636 |
|
| 1637 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00237-01]} |
| 1638 |
@ChgAdded{Version=[2],Text=[After a task has terminated, all of its attributes |
| 1639 |
are finalized, unless they have been finalized earlier. When the master of an |
| 1640 |
instantiation of Ada.Task_Attributes is finalized, the corresponding attribute |
| 1641 |
of each task is finalized, unless it has been finalized earlier.]} |
| 1642 |
@begin{Reason} |
| 1643 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1644 |
@ChgAdded{Version=[2],Text=[This is necessary so that a task attribute does |
| 1645 |
not outlive its type. For instance, that's possible if the instantiation is |
| 1646 |
nested, and the attribute is on a library-level task.]} |
| 1647 |
@end{Reason} |
| 1648 |
@begin{Ramification} |
| 1649 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1650 |
@ChgAdded{Version=[2],Text=[The task owning an attribute cannot, in general, |
| 1651 |
finalize that attribute. That's because the attributes are finalized @i<after> |
| 1652 |
the task is terminated; moreover, a task may have attributes as soon as it is |
| 1653 |
created; the task may never even have been activated.]} |
| 1654 |
@end{Ramification} |
| 1655 |
@end{RunTime} |
| 1656 |
|
| 1657 |
@begin{Bounded} |
| 1658 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0071],ARef=[AI95-00165-01]} |
| 1659 |
@ChgAdded{Version=[1],Text=[@PDefn2{Term=(bounded error),Sec=(cause)} |
| 1660 |
If the package Ada.Task_Attributes is instantiated with a controlled type and |
| 1661 |
the controlled type has user-defined Adjust or Finalize operations that in |
| 1662 |
turn access task attributes by any of the above operations, then a call of |
| 1663 |
Set_Value of the instantiated package constitutes a bounded error. The call |
| 1664 |
may perform as expected or may result in forever blocking the calling task and |
| 1665 |
subsequently some or all tasks of the partition.]} |
| 1666 |
@end{Bounded} |
| 1667 |
|
| 1668 |
@begin{Erron} |
| 1669 |
@PDefn2{Term=(erroneous execution),Sec=(cause)} |
| 1670 |
It is erroneous to dereference the access value returned by a given |
| 1671 |
call on Reference after a subsequent call on Reinitialize for |
| 1672 |
the same task attribute, or after the associated task terminates. |
| 1673 |
@begin{Reason} |
| 1674 |
This allows the storage to be reclaimed for the object |
| 1675 |
associated with an attribute upon Reinitialize or task termination. |
| 1676 |
@end{Reason} |
| 1677 |
|
| 1678 |
@PDefn2{Term=(erroneous execution),Sec=(cause)} |
| 1679 |
If a value of Task_Id is passed as a parameter to any of the operations |
| 1680 |
declared in this package and the corresponding task object no longer exists, |
| 1681 |
the execution of the program is erroneous. |
| 1682 |
|
| 1683 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0071],ARef=[AI95-00165-01]} |
| 1684 |
@ChgRef{Version=[2],Kind=[RevisedAdded],ARef=[AI95-00237-01]} |
| 1685 |
@ChgAdded{Version=[1],Text=[@PDefn2{Term=(erroneous execution),Sec=(cause)} |
| 1686 |
@Chg{Version=[2],New=[An access],Old=[Accesses]} to @Chg{Version=[2],New=[a ],Old=[]}task |
| 1687 |
@Chg{Version=[2],New=[attribute],Old=[attributes]} via a value of type |
| 1688 |
Attribute_Handle @Chg{Version=[2],New=[is],Old=[are]} |
| 1689 |
erroneous if executed concurrently with @Chg{Version=[2],New=[another such access], |
| 1690 |
Old=[each other]} or @Chg{Version=[2],New=[a call],Old=[with calls]} of any of the |
| 1691 |
operations declared in package Task_Attributes.@Chg{Version=[2],New=[ An access |
| 1692 |
to a task attribute is erroneous if executed |
| 1693 |
concurrently with or after the finalization of the task attribute.],Old=[]}]} |
| 1694 |
@begin{Reason} |
| 1695 |
@ChgRef{Version=[1],Kind=[Added]} |
| 1696 |
@ChgAdded{Version=[1],Text=[There is no requirement of atomicity on accesses |
| 1697 |
via a value of type Attribute_Handle.]} |
| 1698 |
@end{Reason} |
| 1699 |
@begin{Ramification} |
| 1700 |
@ChgRef{Version=[2],Kind=[Added]} |
| 1701 |
@ChgAdded{Version=[2],Text=[A task attribute can only be accessed after |
| 1702 |
finalization through a value of type Attribute_Handle. Operations in |
| 1703 |
package Task_Attributes cannot be used to access a task attribute after |
| 1704 |
finalization, because either the master of the instance has been or is in the |
| 1705 |
process of being left (in which case the instance is out of scope and thus |
| 1706 |
cannot be called), or the associated task is already terminated (in which |
| 1707 |
case Tasking_Error is raised for any attempt to call a task attribute |
| 1708 |
operation).]} |
| 1709 |
@end{Ramification} |
| 1710 |
@end{Erron} |
| 1711 |
|
| 1712 |
@begin{ImplReq} |
| 1713 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0071],ARef=[AI95-00165-01]} |
| 1714 |
@Chg{New=[For a given attribute of a given task, the],Old=[The]} implementation |
| 1715 |
shall perform @Chg{New=[the operations declared in this package], |
| 1716 |
Old=[each of the above operations for a given attribute of a given task]} |
| 1717 |
atomically with respect to any @Chg{New=[of these operations of], |
| 1718 |
Old=[other of the above operations for]} the same attribute of the same task. |
| 1719 |
@Chg{New=[The granularity of any locking mechanism necessary to achieve such |
| 1720 |
atomicity is implementation defined.],Old=[]} |
| 1721 |
@ChgImplDef{Version=[1],Kind=[Added],Text=[@Chg{New=[Granularity of |
| 1722 |
locking for Task_Attributes.],Old=[]}]} |
| 1723 |
|
| 1724 |
@begin{Ramification} |
| 1725 |
Hence, other than by dereferencing an access value returned by |
| 1726 |
Reference, an attribute of a given task can be safely read and updated |
| 1727 |
concurrently by multiple tasks. |
| 1728 |
@end{Ramification} |
| 1729 |
|
| 1730 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00237-01]} |
| 1731 |
@Chg{Version=[2],New=[After],Old=[When a]} task |
| 1732 |
@Chg{Version=[2],New=[attributes are finalized],Old=[terminates]}, |
| 1733 |
the implementation shall @Chg{Version=[2],New=[],Old=[finalize |
| 1734 |
all attributes of the task, and ]}reclaim any |
| 1735 |
@Chg{Version=[2],New=[],Old=[other ]}storage associated with the attributes. |
| 1736 |
@end{ImplReq} |
| 1737 |
|
| 1738 |
@begin{DocReq} |
| 1739 |
|
| 1740 |
The implementation shall document the limit on the number of attributes |
| 1741 |
per task, if any, and the limit on the total storage for attribute values |
| 1742 |
per task, if such a limit exists. |
| 1743 |
|
| 1744 |
In addition, if these limits can be configured, the implementation shall |
| 1745 |
document how to configure them. |
| 1746 |
@ChgImplDef{Version=[2],Kind=[Deleted],Text=[@ChgDeleted{Version=[2], |
| 1747 |
Text=[@Chg{New=[Limits on the number and size of task attributes, and how to configure them.], |
| 1748 |
Old=[Implementation-defined aspects of Task_Attributes.]}]}]} |
| 1749 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 1750 |
Text=[For package Task_Attributes, limits on the number and size of task |
| 1751 |
attributes, and how to configure any limits.]}]} |
| 1752 |
@end{DocReq} |
| 1753 |
|
| 1754 |
@begin{Metrics} |
| 1755 |
|
| 1756 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 1757 |
The implementation shall document the following metrics: A task calling the |
| 1758 |
following subprograms shall execute @Chg{Version=[2],New=[at],Old=[in]} a |
| 1759 |
sufficiently high priority as to not |
| 1760 |
be preempted during the measurement period. This period shall start just |
| 1761 |
before issuing the call and end just after the call completes. If the |
| 1762 |
attributes of task T are accessed by the measurement tests, no other task |
| 1763 |
shall access attributes of that task during the measurement period. |
| 1764 |
For all measurements described here, the Attribute type shall be a scalar |
| 1765 |
@Chg{Version=[2],New=[type ],Old=[]}whose size is equal to the size of the |
| 1766 |
predefined @Chg{Version=[2],New=[type Integer],Old=[integer size]}. |
| 1767 |
For each measurement, two cases shall be documented: one |
| 1768 |
where the accessed attributes are of the calling task @Redundant[(that is, |
| 1769 |
the default value for the T parameter is used)], and the other, where T |
| 1770 |
identifies another, non-terminated, task. |
| 1771 |
|
| 1772 |
@Leading@;The following calls (to subprograms in the Task_Attributes package) |
| 1773 |
shall be measured: |
| 1774 |
@begin{Itemize} |
| 1775 |
a call to Value, where the return value is Initial_Value; |
| 1776 |
|
| 1777 |
a call to Value, where the return value is not equal to Initial_Value; |
| 1778 |
|
| 1779 |
a call to Reference, where the return value designates a value equal to |
| 1780 |
Initial_Value; |
| 1781 |
|
| 1782 |
a call to Reference, where the return value designates a value not equal |
| 1783 |
to Initial_Value; |
| 1784 |
|
| 1785 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 1786 |
a call to Set_Value where the Val parameter is not equal to Initial_Value |
| 1787 |
and the old attribute value is equal to Initial_Value@Chg{Version=[2],New=[;],Old=[.]} |
| 1788 |
|
| 1789 |
a call to Set_Value where the Val parameter is not equal to Initial_Value |
| 1790 |
and the old attribute value is not equal to Initial_Value. |
| 1791 |
|
| 1792 |
@end{Itemize} |
| 1793 |
@ChgDocReq{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 1794 |
Text=[The metrics for the Task_Attributes package.]}]} |
| 1795 |
@end{Metrics} |
| 1796 |
|
| 1797 |
@begin{ImplPerm} |
| 1798 |
|
| 1799 |
An implementation need not actually create the object corresponding |
| 1800 |
to a task attribute |
| 1801 |
until its value is set to something other than that of Initial_Value, |
| 1802 |
or until Reference is called for the task attribute. |
| 1803 |
Similarly, when the value of the attribute is |
| 1804 |
to be reinitialized to that of Initial_Value, |
| 1805 |
the object may instead be finalized and its storage reclaimed, to |
| 1806 |
be recreated when needed later. |
| 1807 |
While the object does not exist, the function Value may |
| 1808 |
simply return Initial_Value, rather than implicitly creating the object. |
| 1809 |
@begin{Discussion} |
| 1810 |
The effect of this permission can only be observed if the assignment |
| 1811 |
operation for the corresponding type has side-effects. |
| 1812 |
@end{Discussion} |
| 1813 |
@begin{ImplNote} |
| 1814 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]} |
| 1815 |
This permission means that even though every task has every |
| 1816 |
attribute, storage need only be allocated for those attributes |
| 1817 |
@Chg{Version=[2],New=[for which function Reference has been invoked],Old=[that |
| 1818 |
have been Reference'd]} or set to a value other than that |
| 1819 |
of Initial_Value. |
| 1820 |
@end{ImplNote} |
| 1821 |
|
| 1822 |
An implementation is allowed to place restrictions on the maximum number of |
| 1823 |
attributes a task may have, the maximum size of each attribute, and the |
| 1824 |
total storage size allocated for all the attributes of a task. |
| 1825 |
|
| 1826 |
@end{ImplPerm} |
| 1827 |
|
| 1828 |
@begin{ImplAdvice} |
| 1829 |
|
| 1830 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00434-01]} |
| 1831 |
Some implementations are targeted to domains in which memory use at run |
| 1832 |
time must be completely deterministic. For such implementations, it is |
| 1833 |
recommended that the storage for task attributes will be pre-allocated |
| 1834 |
statically and not from the heap. This can be accomplished by either |
| 1835 |
placing restrictions on the number and the size of the @Chg{Version=[2], |
| 1836 |
New=[],Old=[task's ]}attributes@Chg{Version=[2],New=[ of a task],Old=[]}, |
| 1837 |
or by using the pre-allocated storage for the first N attribute objects, |
| 1838 |
and the heap for the others. In the latter case, N should be documented. |
| 1839 |
|
| 1840 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 1841 |
Text=[If the target domain requires deterministic memory use at run |
| 1842 |
time, storage for task attributes should be pre-allocated |
| 1843 |
statically and the number of attributes pre-allocated should be documented.]}]} |
| 1844 |
|
| 1845 |
@begin{Discussion} |
| 1846 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1847 |
@ChgAdded{Version=[2],Text=[We don't mention @lquotes@;restrictions on the |
| 1848 |
size and number@rquotes (that is, limits) in the text for the |
| 1849 |
Annex, because it is covered by the @DocReqName above, and we try not to |
| 1850 |
repeat requirements in the Annex (they're enough work to meet without |
| 1851 |
having to do things twice).]} |
| 1852 |
@end{Discussion} |
| 1853 |
@end{ImplAdvice} |
| 1854 |
|
| 1855 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00237-01]} |
| 1856 |
@ChgAdded{Version=[2],Text=[Finalization of task attributes and reclamation of |
| 1857 |
associated storage should be performed as soon as possible after task |
| 1858 |
termination.]} |
| 1859 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 1860 |
Text=[Finalization of task attributes and reclamation of |
| 1861 |
associated storage should be performed as soon as possible after task |
| 1862 |
termination.]}]} |
| 1863 |
@begin{Reason} |
| 1864 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00237-01]} |
| 1865 |
@ChgAdded{Version=[2],Text=[This is necessary because the normative wording |
| 1866 |
only says that attributes are finalized @lquotes@;after@rquotes@; |
| 1867 |
task termination. Without this advice, waiting until the instance is |
| 1868 |
finalized would meet the requirements (it is after termination, but may be |
| 1869 |
a very long time after termination). We can't say anything more specific |
| 1870 |
than this, as we do not want to require the overhead of an interaction with |
| 1871 |
the tasking system to be done at a specific point.]} |
| 1872 |
@end{Reason} |
| 1873 |
@begin{Notes} |
| 1874 |
|
| 1875 |
An attribute always exists (after instantiation), and has the initial value. |
| 1876 |
It need not occupy memory until the first operation that potentially |
| 1877 |
changes the attribute value. The same holds true after Reinitialize. |
| 1878 |
|
| 1879 |
The result of the Reference function should be used with care; it is always |
| 1880 |
safe to use that result in the task body whose attribute is being |
| 1881 |
accessed. However, when the result is being used by another task, the |
| 1882 |
programmer must make sure that the task whose attribute is being accessed |
| 1883 |
is not yet terminated. Failing to do so could make the program execution |
| 1884 |
erroneous. |
| 1885 |
|
| 1886 |
@ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00434-01]} |
| 1887 |
@ChgDeleted{Version=[2],Text=[As specified in |
| 1888 |
@RefSecNum{The Package Task_Identification}, if the parameter T (in a call |
| 1889 |
on a subprogram of an instance of this package) identifies a nonexistent |
| 1890 |
task, the execution of the program is erroneous.]} |
| 1891 |
@end{Notes} |
| 1892 |
|
| 1893 |
@begin{DiffWord95} |
| 1894 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0071],ARef=[AI95-00165-01]} |
| 1895 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that use of task |
| 1896 |
attribute operations from within a task attribute operation (by an Adjust |
| 1897 |
or Finalize call) is a bounded error, and that concurrent use of attribute |
| 1898 |
handles is erroneous.]} |
| 1899 |
|
| 1900 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00237-01]} |
| 1901 |
@ChgAdded{Version=[2],Text=[Clarified the wording so that the finalization |
| 1902 |
takes place after the termination of the task or when the instance is |
| 1903 |
finalized (whichever is sooner).]} |
| 1904 |
@end{Diffword95} |
| 1905 |
|
| 1906 |
@LabeledAddedSubClause{Version=[2],Name=[The Package Task_Termination]} |
| 1907 |
|
| 1908 |
@begin{StaticSem} |
| 1909 |
|
| 1910 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 1911 |
@ChgAdded{Version=[2],KeepNext=[T],Type=[Leading],Text=[The following |
| 1912 |
language-defined library package exists:]} |
| 1913 |
@begin{Example} |
| 1914 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1915 |
@ChgAdded{Version=[2],Text=[@key<with> Ada.Task_Identification; |
| 1916 |
@key<with> Ada.Exceptions; |
| 1917 |
@key<package> Ada.Task_Termination @key<is>@ChildUnit{Parent=[Ada],Child=[Task_Termination]} |
| 1918 |
@key<pragma> Preelaborate(Task_Termination);]} |
| 1919 |
|
| 1920 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1921 |
@ChgAdded{Version=[2],Text=[ @key<type> @AdaTypeDefn{Cause_Of_Termination} @key<is> (Normal, Abnormal, Unhandled_Exception);]} |
| 1922 |
|
| 1923 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1924 |
@ChgAdded{Version=[2],Text=[ @key<type> @AdaTypeDefn{Termination_Handler} @key<is access protected procedure> |
| 1925 |
(Cause : @key<in> Cause_Of_Termination; |
| 1926 |
T : @key<in> Ada.Task_Identification.Task_Id; |
| 1927 |
X : @key<in> Ada.Exceptions.Exception_Occurrence);]} |
| 1928 |
|
| 1929 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1930 |
@ChgAdded{Version=[2],Text=[ @key<procedure> @AdaSubDefn{Set_Dependents_Fallback_Handler} |
| 1931 |
(Handler: @key<in> Termination_Handler); |
| 1932 |
@key<function> @AdaSubDefn{Current_Task_Fallback_Handler} @key<return> Termination_Handler;]} |
| 1933 |
|
| 1934 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1935 |
@ChgAdded{Version=[2],Text=[ @key<procedure> @AdaSubDefn{Set_Specific_Handler} |
| 1936 |
(T : @key<in> Ada.Task_Identification.Task_Id; |
| 1937 |
Handler : @key<in> Termination_Handler); |
| 1938 |
@key<function> @AdaSubDefn{Specific_Handler} (T : Ada.Task_Identification.Task_Id) |
| 1939 |
@key<return> Termination_Handler;]} |
| 1940 |
|
| 1941 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1942 |
@ChgAdded{Version=[2],Text=[@key<end> Ada.Task_Termination;]} |
| 1943 |
@end{Example} |
| 1944 |
|
| 1945 |
@end{StaticSem} |
| 1946 |
|
| 1947 |
@begin{RunTime} |
| 1948 |
|
| 1949 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 1950 |
@ChgAdded{Version=[2],Text=[@Defn{termination handler}@Defn2{Term=[handler],Sec=[termination]} |
| 1951 |
The type Termination_Handler identifies a protected |
| 1952 |
procedure to be executed by the implementation when a task terminates. Such a |
| 1953 |
protected procedure is called a @i<handler>. In all cases T identifies the task |
| 1954 |
that is terminating. If the task terminates due to completing the last |
| 1955 |
statement of its body, or as a result of waiting on a terminate alternative, |
| 1956 |
then Cause is set to Normal and X is set to Null_Occurrence. If the task |
| 1957 |
terminates because it is being aborted, then Cause is set to Abnormal and X is |
| 1958 |
set to Null_Occurrence. If the task terminates because of an exception raised |
| 1959 |
by the execution of its @nt{task_body}, then Cause is set to |
| 1960 |
Unhandled_Exception and X is set to the associated exception occurrence.]} |
| 1961 |
|
| 1962 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 1963 |
@ChgAdded{Version=[2],Text=[@Defn{fall-back handler}@Defn2{Term=[termination handler],Sec=[fall-back]} |
| 1964 |
@Defn{specific handler}@Defn2{Term=[termination handler],Sec=[specific]} |
| 1965 |
@Defn2{Term=[set],Sec=[termination handler]} |
| 1966 |
@Defn2{Term=[cleared],Sec=[termination handler]} |
| 1967 |
Each task has two termination handlers, a @i<fall-back handler> and a |
| 1968 |
@i<specific handler>. The specific handler applies only to the task itself, |
| 1969 |
while the fall-back handler applies only to the dependent tasks of the task. |
| 1970 |
A handler is said to be @i<set> if it is associated |
| 1971 |
with a non-null value of type Termination_Handler, and @i<cleared> otherwise. |
| 1972 |
When a task is created, its specific handler and fall-back handler are cleared.]} |
| 1973 |
|
| 1974 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 1975 |
@ChgAdded{Version=[2],Text=[The procedure Set_Dependents_Fallback_Handler |
| 1976 |
changes the fall-back handler for the calling task; if Handler is @key{null}, |
| 1977 |
that fall-back handler is cleared, otherwise it is set to be Handler.@key{all}. |
| 1978 |
If a fall-back handler had previously been set it is replaced.]} |
| 1979 |
|
| 1980 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 1981 |
@ChgAdded{Version=[2],Text=[The function Current_Task_Fallback_Handler returns |
| 1982 |
the fall-back handler that is currently set for the calling task, if one is |
| 1983 |
set; otherwise it returns @key{null}.]} |
| 1984 |
|
| 1985 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 1986 |
@ChgAdded{Version=[2],Text=[The procedure Set_Specific_Handler changes the |
| 1987 |
specific handler for the task identified by T; if Handler is @key{null}, that |
| 1988 |
specific handler is cleared, otherwise it is set to be Handler.@key{all}. If a |
| 1989 |
specific handler had previously been set it is replaced.]} |
| 1990 |
|
| 1991 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 1992 |
@ChgAdded{Version=[2],Text=[The function Specific_Handler returns the specific |
| 1993 |
handler that is currently set for the task identified by T, if one is set; |
| 1994 |
otherwise it returns @key{null}.]} |
| 1995 |
|
| 1996 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 1997 |
@ChgAdded{Version=[2],Text=[As part of the finalization of a @nt{task_body}, |
| 1998 |
after performing the actions specified in |
| 1999 |
@RefSecNum{User-Defined Assignment and Finalization} for finalization of a |
| 2000 |
master, the specific handler for the task, if one is set, is executed. |
| 2001 |
If the specific handler is cleared, a search |
| 2002 |
for a fall-back handler proceeds by recursively following the master |
| 2003 |
relationship for the task. If a task is found whose fall-back handler is set, |
| 2004 |
that handler is executed; otherwise, no handler is executed.]} |
| 2005 |
|
| 2006 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 2007 |
@ChgAdded{Version=[2],Text=[For Set_Specific_Handler or |
| 2008 |
Specific_Handler, Tasking_Error is raised if the task identified by T has |
| 2009 |
already terminated. Program_Error is raised if the value of T is |
| 2010 |
Ada.Task_Identification.Null_Task_Id.]} |
| 2011 |
|
| 2012 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 2013 |
@ChgAdded{Version=[2],Text=[An exception propagated from a handler that is |
| 2014 |
invoked as part of the termination of a task has no effect.]} |
| 2015 |
|
| 2016 |
@end{RunTime} |
| 2017 |
|
| 2018 |
@begin{Erron} |
| 2019 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 2020 |
@ChgAdded{Version=[2],Text=[For a call of Set_Specific_Handler or |
| 2021 |
Specific_Handler, if the task identified by T no longer exists, the execution |
| 2022 |
of the program is erroneous.]} |
| 2023 |
@end{Erron} |
| 2024 |
|
| 2025 |
@begin{Extend95} |
| 2026 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00266-02]} |
| 2027 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 2028 |
Package Task_Termination is new.]} |
| 2029 |
@end{Extend95} |
| 2030 |
|