From: Simon Wright <simon@pushface.org>
Subject: Re: Task origin track from a class
Date: Tue, 12 Jul 2011 06:57:54 +0100
Date: 2011-07-12T06:57:54+01:00 [thread overview]
Message-ID: <m2oc10xcpp.fsf@pushface.org> (raw)
In-Reply-To: e05f6958-33e1-4660-bdfa-c370ca466c02@glegroupsg2000goo.googlegroups.com
"Rego, P." <pvrego@gmail.com> writes:
> I have a class Def_Class which defines a record which is a task. Say:
> task type My_Task_Kind;
>
> type Def_Class is tagged limited
> record
> Some_Element : Integer; -- or other type anyway
> My_Task : My_Task_Kind;
> end record;
>
> and I want to access my class inside the task body, something like
> type body My_Task_Kind (Origin: Def_Class) is
> begin
> if Origin.Some_Element = 1 then
> (...)
> end if;
> end My_Task_Kind;
>
> So how can I do it? (I tried to use an entry type, but got problems
> with limited/non limited types, so asking for help!!)
Using a constraint:
package Rego is
type C;
task type T (The_C : access C);
type C is tagged limited record
The_T : T (C'Access);
Done : Boolean := False;
end record;
end Rego;
package body Rego is
task body T is
begin
The_C.Done := True;
end;
end Rego;
with Ada.Text_IO; use Ada.Text_IO;
with Rego;
procedure Rego_D is
The_C : Rego.C;
begin
Put_Line (Boolean'Image (The_C.Done));
end Rego_D;
next prev parent reply other threads:[~2011-07-12 5:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-12 3:24 Task origin track from a class Rego, P.
2011-07-12 5:57 ` Simon Wright [this message]
2011-07-12 7:41 ` Dmitry A. Kazakov
2011-07-12 10:29 ` Simon Wright
2011-07-12 10:31 ` Simon Wright
2011-07-13 0:36 ` Shark8
2011-07-13 2:57 ` Rego, P.
2011-07-13 7:41 ` Dmitry A. Kazakov
2011-07-13 8:43 ` Georg Bauhaus
2011-07-13 11:59 ` Dmitry A. Kazakov
2011-07-13 16:31 ` Shark8
2011-07-13 17:22 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox