From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Problem with task component
Date: Wed, 19 Sep 2012 23:11:20 +0200
Date: 2012-09-19T23:11:20+02:00 [thread overview]
Message-ID: <187uk10m6z8xj.yr1cpbgrdur$.dlg@40tude.net> (raw)
In-Reply-To: m2a9wl4ugn.fsf@pushface.org
On Wed, 19 Sep 2012 21:40:40 +0100, Simon Wright wrote:
> Also, it seems to me that if I don't use pointers I'm going to have
> trouble finalizing the object: the contained task is sitting there and
> prevents leaving the scope in which its containing object is declared,
> so the containing object doesn't get finalized and there's no
> opportunity for Finalize to tell the task to stop.
You need an open terminate-alternative ("or terminate;") when the object
containing the task component is about to finalize.
The usual problem is that the terminate-alternative does not live together
with the delay-alternative and/or else-part, which makes it quite a
challenge to implement something like a typical "driver" component task:
task body Driver is
begin
loop
do I/O;
exit/terminate when parent dies;
end loop;
end Driver;
If the I/O subsystem calls to the task upon I/O completion, you could try
something like this:
task body Driver is
begin
loop
Start_IO (Self);
select
accept Completed (...);
... -- Process the data
or accept Canceled;
... -- I/O was canceled
or accept Error (...);
... -- I/O error
or terminate; -- Still have troubles killing all outstanding requests
end select; -- which may refer to the driver task, that is gone
end loop; -- by now
end Driver;
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2012-09-19 21:11 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-19 18:22 Problem with task component Simon Wright
2012-09-19 18:48 ` Dmitry A. Kazakov
2012-09-19 20:40 ` Simon Wright
2012-09-19 21:11 ` Dmitry A. Kazakov [this message]
2012-09-19 21:48 ` Simon Wright
2012-09-24 5:28 ` J-P. Rosen
2012-09-24 8:23 ` Simon Wright
2012-09-24 13:37 ` J-P. Rosen
2012-09-24 14:17 ` Simon Wright
2012-09-24 17:53 ` Robert A Duff
2012-09-24 20:40 ` J-P. Rosen
2012-09-24 15:44 ` Adam Beneschan
2012-09-24 16:13 ` AdaMagica
2012-09-24 16:43 ` Adam Beneschan
2012-09-24 16:29 ` Dmitry A. Kazakov
2012-09-24 20:49 ` J-P. Rosen
2012-09-25 7:35 ` Dmitry A. Kazakov
2012-09-25 17:52 ` J-P. Rosen
2012-09-25 18:35 ` Dmitry A. Kazakov
2012-09-25 19:22 ` J-P. Rosen
2012-09-26 7:27 ` Dmitry A. Kazakov
2012-09-26 11:49 ` Georg Bauhaus
2012-09-26 14:13 ` Dmitry A. Kazakov
2012-09-19 19:44 ` Adam Beneschan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox