---------------------------------
-- D. Mathieu                  --
--                             --
-- fichier Essai16C.adb        --
--                             --
-- créé le 30/12/98            --
--                             --
---------------------------------
--
-- Initialisation d'une tâche par son discriminant
--
-- Solution plus élégante, proposée par J. Barnes

with Ada.Text_IO;
use  Ada.Text_IO;

procedure Essai16C is
 
    I : Natural := 0;
    function GetRang return Positive is
    begin -- GetRang
        I := I + 1;
        return I;
    end GetRang;

    CstMaxTaches : constant := 4;
 
    task type T_Tsk (Indice : Positive := GetRang);
 
    LesDelais : array (1..CstMaxTaches) of Duration
              := (1.0, 2.0, 3.0, 4.0, others => 0.0);
 
    LesTaches : array (1..CstMaxTaches) of T_Tsk;  -- les initialisations
                                                   -- sont effectuées ici
 
    task body T_Tsk is
 
    begin -- T_Tsk
 
        delay LesDelais (Indice);
        Put_Line ("Fini");
 
    end T_Tsk;
 
begin  -- Essai16D

    null;
 
end Essai16C;