Thread View: net.lang.ada
1 messages
1 total messages
Started by Bryan Doug Bryan
Fri, 17 Oct 1986 21:10
Re: Need to see certain data inside a task type.
Author: Bryan Doug Bryan
Date: Fri, 17 Oct 1986 21:10
Date: Fri, 17 Oct 1986 21:10
58 lines
1876 bytes
1876 bytes
Here is an idea for you... let me know if you get anything better.
doug
........................
generic
package Pack is
task type T is
entry My_Discriminant (D : Integer);
entry Echo_Discriminant;
end T;
type Acc is access T;
function F (D : Integer) return Acc;
type Rec (D : Integer) is
record
Acc_T : Acc := F (D);
end record;
end Pack;
-------------------------------
with Text_Io;
package body Pack is
function F (D : Integer) return Acc is
A : Acc := new T;
begin
A.My_Discriminant (D);
return A;
end F;
task body T is
Local_Discriminant : Integer;
begin
accept My_Discriminant (D : Integer) do
Local_Discriminant := D;
end My_Discriminant;
accept Echo_Discriminant;
Text_Io.Put_Line (Integer'Image (Local_Discriminant));
end T;
end Pack;
-------------------------------
with Pack;
procedure Disc_Task is
package P is new Pack;
-- Pack is generic in order to force elaboration of body before
-- the following objects are elaborated.
Rec_1 : P.Rec (1);
Rec_2 : P.Rec (2);
Rec_3 : P.Rec (3);
begin
Rec_1.Acc_T.Echo_Discriminant;
Rec_2.Acc_T.Echo_Discriminant;
Rec_3.Acc_T.Echo_Discriminant;
end Disc_Task;
-------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads