[comp.lang.ada] passing a task type as a generic parameter

CONTR22@NOSC-TECR.ARPA.UUCP (07/07/87)

Can anyone answer the following from my colleague, Jim Silver:

-- According to the LRM, we can pass a task type as the actual parameter
-- corresponding to Formal_Task_Type in the following generic procedure.

generic
    type Formal_Task_Type is limited private;
procedure Generic_Procedure
(
    Task_Object : Formal_Task_Type
);

procedure Generic_Procedure
(
    Task_Object : Formal_Task_Type
) is
begin

    -- Great, but what useful thing can we do with Task_Object here?
    -- In particular, is there any way to call an entry in Task_Object?

    null;
end Generic_Procedure;


with Generic_Procedure;
procedure User_Procedure is
    task type
        Actual_Task_Type is
            entry Entry_Point;
        end Actual_Task_Type;

    Task_Object_1 : Actual_Task_Type;
    Task_Object_2 : Actual_Task_Type;

    task body Actual_Task_Type is
    begin
        accept Entry_Point;
    end Actual_Task_Type;

    procedure Instantiated_Procedure is new Generic_Procedure(Actual_Task_Type);

begin
    -- Or, from the user's viewpoint, is there a mechanism which allows the
    -- first invocation below to call Task_Object_1.Entry_Point and the second
    -- to call Task_Object_2.Entry_Point?
    Instantiated_Procedure( Task_Object_1 );
    Instantiated_Procedure( Task_Object_2 );
end User_Procedure;

-- (I know that I can rewrite Generic_Procedure with a generic formal
-- procedure parameter then instantiate it twice, once with each entry
-- point, to get the same effect.  I would like to know if I can use task

Thanks.
Linda Rising
Magnavox
Ft. Wayne, IN
-- types to avoid this.)