D.7 Tasking Restrictions
This Reference Manual output has not been verified, and may contain omissions or errors. Report any problems on the tracking issue
[This subclause defines restrictions that can be used with a pragma Restrictions (see 13.12) to facilitate the construction of highly efficient tasking run-time systems.]
Static Semantics
1.1/5A scalar expression
within a protected unit is said to be pure-barrier-eligible if it is one of the following:
- a static expression;
- a
name
that statically names (see 4.9) a scalar subcomponent of the immediately enclosing protected unit; 1.4/5 - a Count
attribute_reference
whoseprefix
statically denotes an entry declaration of the immediately enclosing unit; 1.5/5 - a call to a predefined relational operator or boolean logical operator (and, or, xor, not), where each operand is pure-barrier-eligible;
- a membership test whose tested_
simple_expression
is pure-barrier-eligible, and whosemembership_choice_list
meets the requirements for a static membership test (see 4.9); 1.7/5 - a short-circuit control form both of whose operands are pure-barrier-eligible;
- a
conditional_expression
all of whosecondition
s, selecting_expression
s, and dependent_expression
s are pure-barrier-eligible; or 1.9/5 - a pure-barrier-eligible
expression
enclosed in parentheses.
The following restriction_identifier
s are language defined:
No_Task_Hierarchy
- No task depends on a master other than the library-level master.
{8652/0042} No_Nested_Finalization
- Objects of a type that needs finalization (see 7.6) are declared only at library level. If an access type does not have library-level accessibility, then there are no
allocator
s of the type where the type determined by thesubtype_mark
of thesubtype_indication
orqualified_expression
needs finalization.
No_Abort_Statements
- There are no
abort_statement
s, and there is no use of aname
denoting Task_Identification.Abort_Task. 6
No_Terminate_Alternatives- There are no
selective_accept
s withterminate_alternative
s. 7
No_Task_Allocators- There are no
allocator
s for task types or types containing task subcomponents. 7.1/3 - In the case of an initialized
allocator
of an access type whose designated type is class-wide and limited, a check is made that the specific type of the allocated object has no task subcomponents. Program_Error is raised if this check fails. 8
No_Implicit_Heap_Allocations- There are no operations that implicitly require heap storage allocation to be performed by the implementation. The operations that implicitly require heap storage allocation are implementation defined.
No_Dynamic_Priorities
- There are no semantic dependences on the package Dynamic_Priorities, and no occurrences of the attribute Priority.
No_Dynamic_Attachment- There is no use of a
name
denoting any of the operations defined in package Interrupts (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler, Detach_Handler, and Reference).
No_Dynamic_CPU_Assignment
- No task has the CPU aspect specified to be a non-static expression. Each task (including the environment task) that has the CPU aspect specified as Not_A_Specific_CPU will be assigned to a particular implementation-defined CPU. The same is true for the environment task when the CPU aspect is not specified. [Any other task without a CPU aspect will activate and execute on the same processor as its activating task.]
No_Local_Protected_Objects
- Protected objects are declared only at library level.
No_Local_Timing_Events- Timing_Events are declared only at library level.
No_Protected_Type_Allocators- There are no
allocator
s for protected types or types containing protected type subcomponents. 10.5/3 - In the case of an initialized
allocator
of an access type whose designated type is class-wide and limited, a check is made that the specific type of the allocated object has no protected subcomponents. Program_Error is raised if this check fails. 10.6/3
No_Relative_Delay- There are no
delay_relative_statement
s, and there is no use of aname
that denotes the Timing_Events.Set_Handler subprogram that has a Time_Span parameter. 10.7/3
No_Requeue_Statements- There are no
requeue_statement
s. 10.8/3
No_Select_Statements- There are no
select_statement
s. 10.9/3
No_Specific_Termination_Handlers- There is no use of a
name
denoting the Set_Specific_Handler and Specific_Handler subprograms in Task_Termination. 10.10/4
No_Tasks_Unassigned_To_CPU- The CPU aspect is specified for the environment task. No CPU aspect is specified to be statically equal to Not_A_Specific_CPU. If aspect CPU is specified (dynamically) to the value Not_A_Specific_CPU, then Program_Error is raised. If Set_CPU or Delay_Until_And_Set_CPU are called with the CPU parameter equal to Not_A_Specific_CPU, then Program_Error is raised.
Pure_Barriers
- The Boolean expression in each protected entry barrier is pure-barrier-eligible.
Simple_Barriers- The Boolean expression in each entry barrier is either a static expression or a
name
that statically names (see 4.9) a subcomponent of the enclosing protected object.
The following restriction_parameter_identifier
s are language defined:
Max_Select_Alternatives
- Specifies the maximum number of alternatives in a
selective_accept
. 13
Max_Task_Entries- Specifies the maximum number of entries per task. The bounds of every entry family of a task unit shall be static, or shall be defined by a discriminant of a subtype whose corresponding bound is static. [A value of zero indicates that no rendezvous are possible.]
Max_Protected_Entries- Specifies the maximum number of entries per protected type. The bounds of every entry family of a protected unit shall be static, or shall be defined by a discriminant of a subtype whose corresponding bound is static.
Dynamic Semantics
15/2{8652/0076} The following restriction_identifier
is language defined:
No_Task_Termination
- All tasks are nonterminating. It is implementation-defined what happens if a task attempts to terminate. If there is a fall-back handler (see C.7.3) set for the partition it should be called when the first task attempts to terminate.
The following restriction_parameter_identifier
s are language defined:
{8652/0076} Max_Storage_At_Blocking
- Specifies the maximum portion [(in storage elements)] of a task's Storage_Size that can be retained by a blocked task. If an implementation chooses to detect a violation of this restriction, Storage_Error should be raised; otherwise, the behavior is implementation defined.
{8652/0076} Max_Asynchronous_Select_Nesting
- Specifies the maximum dynamic nesting level of
asynchronous_select
s. A value of zero prevents the use of anyasynchronous_select
and, if a program contains anasynchronous_select
, it is illegal. If an implementation chooses to detect a violation of this restriction for values other than zero, Storage_Error should be raised; otherwise, the behavior is implementation defined.
{8652/0076} Max_Tasks
- Specifies the maximum number of task creations that may be executed over the lifetime of a partition, not counting the creation of the environment task. A value of zero prevents any task creation and, if a program contains a task creation, it is illegal. If an implementation chooses to detect a violation of this restriction, Storage_Error should be raised; otherwise, the behavior is implementation defined.
Max_Entry_Queue_Length
- Max_Entry_Queue_Length defines the maximum number of calls that are queued on an entry. Violation of this restriction results in the raising of Program_Error at the point of the call or requeue.
No_Standard_Allocators_After_Elaboration- Specifies that an
allocator
using a standard storage pool (see 13.11) shall not occur within a parameterless library subprogram, nor within thehandled_sequence_of_statements
of a task body. For the purposes of this rule, anallocator
of a type derived from a formal access type does not use a standard storage pool. 19.3/3 - At run time, Storage_Error is raised if an
allocator
using a standard storage pool is evaluated after the elaboration of thelibrary_item
s of the partition has completed.
It is implementation defined whether the use of pragma Restrictions results in a reduction in executable program size, storage requirements, or execution time. If possible, the implementation should provide quantitative descriptions of such effects for each restriction.
Implementation Advice
21When feasible, the implementation should take advantage of the specified restrictions to produce a more efficient implementation.
Incompatibilities With Ada 95
Extensions to Ada 95
Wording Changes from Ada 95
Incompatibilities With Ada 2005
allocator
s rather than objects of specific access types. It seems unlikely that any program depending on this restriction would violate it in this blatant manner, so it is expected that very few programs will be affected by this change.name
that denotes" that subprogram. This closes a hole where renames, uses as the prefix of 'Access, and the like, would not be rejected by the restriction, possibly allowing backdoor access to the prohibited subprogram. A program that uses one of these restrictions and using such backdoor access will now be rejected; however, it is extremely unlikely that any program that relies on these restrictions would also use an end-run around the restriction, so it is expected that very few programs will be affected by this change.