Description
Owns one generation of an application-defined Ada task type. The task may declare application-specific entries, discriminants, aspects, and a body; this package supplies only structured construction, observation, optional abort dispatch, and the local Ada master that joins it.
Abort_Task
procedure Abort_Task (Subject : in out Generation_Task)
Perform "abort Subject" without retaining Subject. The adapter must return promptly; Ada may still defer the task's response to abort. A directly visible profile-conformant Abort_Task is inferred by name when omitted.
Parameters
- Subject
Application_Context
type Application_Context (<>) is limited private;
Create
function Create
(Context : not null access Application_Context; Control : not null access Generation_Control)
return Generation_Task
Construct the exact application task object by limited build-in-place return. Create may choose any task discriminants, but must not retain shorter-lived state beyond the returned task object's join boundary. Create should only construct the object; an exception from Create or task activation propagates from Run for the enclosing controller to classify. A directly visible profile-conformant Create is inferred by name when the generic actual is omitted.
Parameters
- Context
- Control
Return value
Generation_Task
type Generation_Task (<>) is limited private;
Initialize
procedure Initialize (Subject : in out Generation_Task; Control : aliased in out Generation_Control)
Invoke task-specific entries or package operations immediately after activation. Initialize runs outside supervisor locks, must not retain an access to Subject, and must return for readiness and stop deadlines to remain observable.
Parameters
- Subject
Newly activated application task object
- Control
Borrowed generation control
Run
procedure Run
(Context : aliased in out Application_Context;
Control : aliased in out Generation_Control;
Result : out Generation_Result)
Construct, activate, observe, and join one application-defined task object. Flyology.Task_Results automatically classifies normal return, an exception escaping the task body, or abnormal completion after task finalization; the task body does not need a reporting handler. Tasking_Error from activation propagates because no task body began and therefore no task result exists. Any other Create exception also propagates. An Initialize exception is copied as an Unhandled_Exception and requests cooperative stop. Abort_Task is called at most once and only after the supervisor's configured grace period requests abort.
Parameters
- Context
Application state retained through task finalization
- Control
Fresh generation readiness, stop, and outcome channel
- Result
Bounded outcome returned only after task termination
Raised exceptions
- Tasking_Error
Generation task activation failed
Task_Identity
function Task_Identity (Subject : in out Generation_Task) return Ada.Task_Identification.Task_Id
Return Subject'Identity without retaining Subject or performing a potentially blocking operation. A directly visible profile-conformant Task_Identity is inferred by name when omitted.
Parameters
- Subject