DocAda(tm) is a productivity tool of KSCE
|
|
|
| ![]()
About DocAda Light:
Preface / Preliminary
/ Help
/ TOC
/ Copyright
DocAda Online at the Ada Home:
Complete RM95
/ Updates
/ News
A task unit is declared by a task declaration, which has a corresponding task_body. A task declaration may be a task_type_declaration, in which case it declares a named task type; alternatively, it may be a single_task_declaration, in which case it defines an anonymous task type, as well as declaring a named task object of that type.
Syntax
task_type_declaration ::=
task type defining_identifier [known_discriminant_part] [is task_definition];
single_task_declaration ::=
task defining_identifier [is task_definition];
task_definition ::=
{task_item}
[ private
{task_item}]
end [task_identifier]
task_item ::= entry_declaration | representation_clause
task_body ::=
task body defining_identifier is
declarative_part
begin
handled_sequence_of_statements
end [task_identifier];
Legality Rules
A task declaration requires a completion, which shall be a task_body, and every task_body shall be the completion of some task declaration.
Static Semantics
A task_definition defines a task type and its first subtype. The first list of task_items of a task_definition, together with the known_discriminant_part, if any, is called the visible part of the task unit. The optional list of task_items after the reserved word private is called the private part of the task unit.
Dynamic Semantics
The elaboration of a task declaration elaborates the task_definition. The elaboration of a single_task_declaration also creates an object of an (anonymous) task type.
The elaboration of a task_definition creates the task type and its first subtype; it also includes the elaboration of the entry_declarations in the given order.
As part of the initialization of a task object, any representation_clauses and any per-object constraints associated with entry_declarations of the corresponding task_definition are elaborated in the given order.
The elaboration of a task_body has no effect other than to establish that tasks of the type can from then on be activated without failing the Elaboration_Check.
The execution of a task_body is invoked by the activation of a task of the corresponding type (see 9.2).
The content of a task object of a given task type includes:
NOTES
Examples
Examples of declarations of task types:
task type Server is
entry Next_Work_Item(WI : in Work_Item);
entry Shut_Down;
end Server;
task type Keyboard_Driver(ID : Keyboard_ID := New_ID) is
entry Read (C : out Character);
entry Write(C : in Character);
end Keyboard_Driver;
Examples of declarations of single tasks:
task Controller is
entry Request(Level)(D : Item); -- a family of entries
end Controller;
task Parser is
entry Next_Lexeme(L : in Lexical_Element);
entry Next_Action(A : out Parser_Action);
end;
task User; -- has no entries
Examples of task objects:
Agent : Server;
Teletype : Keyboard_Driver(TTY_ID);
Pool : array(1 .. 10) of Keyboard_Driver;
Example of access type designating task objects:
type Keyboard is access Keyboard_Driver;
Terminal : Keyboard := new Keyboard_Driver(Term_ID);
About DocAda Light:
Preface / Preliminary
/ Help
/ TOC
/ Copyright
DocAda Online at the Ada Home:
Complete RM95
/ Updates
/ News
|
|
|
| ![]()