Go to the first, previous, next, last section, table of contents.


C.7.1 The Package Task_Identification

Static Semantics

  1. The following language-defined library package exists:
  2. package Ada.Task_Identification is
       type Task_ID is private;
       Null_Task_ID : constant Task_ID;
       function  "=" (Left, Right : Task_ID) return Boolean;
    
  3.    function  Image        (T : Task_ID) return String;
       function  Current_Task return Task_ID;
       procedure Abort_Task   (T : in out Task_ID);
    
  4.    function  Is_Terminated(T : Task_ID) return Boolean;
       function  Is_Callable  (T : Task_ID) return Boolean;
    private
       ... -- not specified by the language
    end Ada.Task_Identification;
    

    Dynamic Semantics

  5. A value of the type Task_ID identifies an existent task. The constant Null_Task_ID does not identify any task. Each object of the type Task_ID is default initialized to the value of Null_Task_ID.
  6. The function "=" returns True if and only if Left and Right identify the same task or both have the value Null_Task_ID.
  7. The function Image returns an implementation-defined string that identifies T. If T equals Null_Task_ID, Image returns an empty string.
  8. The function Current_Task returns a value that identifies the calling task.
  9. The effect of Abort_Task is the same as the abort_statement for the task identified by T. In addition, if T identifies the environment task, the entire partition is aborted, See section E.1 Partitions.
  10. The functions Is_Terminated and Is_Callable return the value of the corresponding attribute of the task identified by T.
  11. For a prefix T that is of a task type (after any implicit dereference), the following attribute is defined:
  12. T'Identity
  13. Yields a value of the type Task_ID that identifies the task
    denoted by T.
    
  14. For a prefix E that denotes an entry_declaration, the following attribute is defined:
  15. E'Caller
    Yields a value of the type Task_ID that identifies the task
    whose call is now being serviced. Use of this attribute is
    allowed only inside an entry_body or accept_statement
    corresponding to the entry_declaration denoted by E.
    
  16. Program_Error is raised if a value of Null_Task_ID is passed as a parameter to Abort_Task, Is_Terminated, and Is_Callable.
  17. Abort_Task is a potentially blocking operation, See section 9.5.1 Protected Subprograms and Protected Actions.

    Bounded (Run-Time) Errors

  18. It is a bounded error to call the Current_Task function from an entry body or an interrupt handler. Program_Error is raised, or an implementation-defined value of the type Task_ID is returned.

    Erroneous Execution

  19. If a value of Task_ID is passed as a parameter to any of the operations declared in this package (or any language-defined child of this package), and the corresponding task object no longer exists, the execution of the program is erroneous.

    Documentation Requirements

  20. The implementation shall document the effect of calling Current_Task from an entry body or interrupt handler.

    NOTES

  21. (10) This package is intended for use in writing user-defined task scheduling packages and constructing server tasks. Current_Task can be used in conjunction with other operations requiring a task as an argument such as Set_Priority, See section D.5 Dynamic Priorities.
  22. (11) The function Current_Task and the attribute Caller can return a Task_ID value that identifies the environment task.


Go to the first, previous, next, last section, table of contents.