From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Using the "Terminated" aspect for a task passed to a generic
Date: Mon, 23 Apr 2018 18:29:28 +0200
Date: 2018-04-23T18:29:28+02:00 [thread overview]
Message-ID: <pbl1la$1c3a$1@gioia.aioe.org> (raw)
In-Reply-To: f2cc5db4-1abf-4a4c-92ed-089e0e7d6d21@googlegroups.com
On 2018-04-23 16:20, NiGHTS wrote:
> Having looked carefully through 2 Ada reference books, one dedicated to tasking, and using Google to no end, I am stumped on the following Ada dilemma.
>
> generic
>
> type Managed_Task_Type is limited private;
I am not sure if that would work, but you could try your luck with
type Managed_Task_Type is
new Task_Type and task interface with private;
or
type Managed_Task_Type is
synchronized new Task_Type with private;
A better way, almost always, is to put the task into a tagged object and
pass that down:
task type Task_Type is ...
type Task_Object is
new Ada.Finalization.Limited_Controlled with
record
The_Task : Task_Type;
end record;
function Is_Terminated (Object : Task_Object) return Boolean is
begin
return Object.The_Task'Terminated;
end Is_Terminated;
generic
type Managed_Task_Type is new Task_Object with private;
package WD is
...
task body WD_Thread is
M : Managed_Task_Type;
begin
while not M.Is_Terminated loop
...
end loop;
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2018-04-23 16:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-23 14:20 Using the "Terminated" aspect for a task passed to a generic NiGHTS
2018-04-23 15:40 ` AdaMagica
2018-04-23 16:23 ` Jeffrey R. Carter
2018-04-23 16:29 ` Dmitry A. Kazakov [this message]
2018-04-23 16:35 ` Dan'l Miller
2018-04-23 16:41 ` Dmitry A. Kazakov
2018-04-23 17:04 ` Dan'l Miller
2018-04-23 17:18 ` NiGHTS
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox