From: Simon Wright <simon@pushface.org>
Subject: Re: Delayed deallocation of non-terminated task in Gnat?
Date: Wed, 31 Aug 2011 22:53:30 +0100
Date: 2011-08-31T22:53:30+01:00 [thread overview]
Message-ID: <m2y5y9dz8l.fsf@pushface.org> (raw)
In-Reply-To: wccmxepcmp0.fsf@shell01.TheWorld.com
Robert A Duff <bobduff@shell01.TheWorld.com> writes:
> You can loop, checking 'Terminated, with a delay. But the delay is
> guaranteed to be either too long or too short -- most likely both.
> The feature we're talking about was implemented because there was such
> a loop, and it was causing an AdaCore customer's program (with
> thousands of dynamically allocated tasks) to take half an hour. After
> implementing this feature, and removing the loop-with-delay, it took a
> few seconds.
We couldn't afford to wait, so once we discovered the leak we arranged
that all tasks to be deleted were aborted and placed on a special list;
a low-priority task did the loop-with-delay-until-terminated and then
the U_D.
generic
type Task_Type (<>) is limited private;
-- The class's task type (T).
type Task_Type_P is access Task_Type;
-- The class's pointer-to-task (T_P).
with function Is_Terminated (It : Task_Type_P) return Boolean;
-- We can't say that Task_Type is actually a task, so we can't use
-- 'Identity.
package ColdFrame.Task_Deletion_G is
procedure Free (It : Task_Type_P);
-- Puts It on the queue of tasks to be freed.
private
(a) all the instantiations and calls of this code were autogenerated, so
the developer pain was minimised;
(b) we didn't have many task deletions (mainly on network disconnects).
next prev parent reply other threads:[~2011-08-31 21:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-30 13:22 Delayed deallocation of non-terminated task in Gnat? Marc C
2011-08-30 15:20 ` Dmitry A. Kazakov
2011-08-31 18:12 ` Robert A Duff
2011-08-31 19:23 ` Dmitry A. Kazakov
2011-08-31 20:58 ` Robert A Duff
2011-08-31 21:16 ` Jeffrey Carter
2011-08-31 20:25 ` J-P. Rosen
2011-08-31 21:09 ` Robert A Duff
2011-08-31 21:53 ` Simon Wright [this message]
2011-08-30 15:38 ` Adam Beneschan
2011-08-30 16:42 ` Dmitry A. Kazakov
2011-08-30 18:57 ` Niklas Holsti
2011-08-30 19:23 ` Dmitry A. Kazakov
2011-08-31 16:39 ` Adam Beneschan
2011-08-31 18:21 ` Robert A Duff
2011-08-31 23:28 ` Adam Beneschan
2011-09-01 11:58 ` Robert A Duff
2011-08-31 20:30 ` J-P. Rosen
2011-08-31 22:36 ` Adam Beneschan
2011-09-01 5:24 ` J-P. Rosen
2011-08-31 18:08 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox