From: Bob Duff <bobduff@theworld.com>
Subject: Re: Abortable Timed Action
Date: Sat, 09 Jan 2016 09:41:49 -0500
Date: 2016-01-09T09:41:49-05:00 [thread overview]
Message-ID: <87a8oehl1u.fsf@theworld.com> (raw)
In-Reply-To: ly37u7p2dd.fsf@pushface.org
Simon Wright <simon@pushface.org> writes:
> GNAT certainly used to have issues in this area. Indeed, you could abort
> the task and then deallocate it, and end with a memory leak (the task
> control block wasn't actually freed); the cure was to wait until
> 'Terminated.
>
> I believe that this is no longer a problem.
When you call Unchecked_Deallocation on an object containing tasks that
are not yet terminated, they keep running. GNAT used to have a memory
leak as you say. I think it was fixed perhaps 2 years ago. So with
the latest GNAT, when you call Unchecked_Deallocation, the memory is
freed for tasks that are already terminated. Not-yet-terminated tasks
keep running, and the memory gets freed when they terminate.
It is a language design flaw that you can't block a task until some
other task(s) are terminated -- other than at scope exit, which is
usually way too late. You can busy wait:
abort T;
-- Now T is aborting itself, running finalization actions and whatnot.
while not T'Terminated loop
delay X;
end loop;
-- Here, we know that T is terminated.
But X is guaranteed to be too long or too short -- most likely both. ;-)
- Bob
next prev parent reply other threads:[~2016-01-09 14:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-31 4:15 Abortable Timed Action T.G.
2015-12-31 6:40 ` Anh Vo
2015-12-31 7:32 ` T.G.
2015-12-31 16:21 ` Anh Vo
2015-12-31 18:09 ` T.G.
2016-01-06 21:14 ` Anh Vo
2016-01-08 20:24 ` T.G.
2016-01-09 8:45 ` Simon Wright
2016-01-09 9:10 ` Dmitry A. Kazakov
2016-01-09 14:41 ` Bob Duff [this message]
2016-01-09 15:59 ` T.G.
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox