comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Task origin track from a class
Date: Wed, 13 Jul 2011 09:41:11 +0200
Date: 2011-07-13T09:41:11+02:00	[thread overview]
Message-ID: <13h82glc3htf0.1sjzw91gfndbf$.dlg@40tude.net> (raw)
In-Reply-To: 024dd037-7c8f-460a-8ec4-0bf2456435ee@fq4g2000vbb.googlegroups.com

On Tue, 12 Jul 2011 17:36:29 -0700 (PDT), Shark8 wrote:

> On Jul 12, 5:31�am, Simon Wright <si...@pushface.org> wrote:
>> Simon Wright <si...@pushface.org> writes:
>>> "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> writes:
>>
>>>> So the unfortunate rule of the thumb is: never use task components,
>>>> but access to task instead. From Finalize you would call Stop entry or
>>>> an equivalent and then free the task object using
>>>> Unchecked_Deallocation.
>>
>>> With GNAT, best not to free the task object until 'Terminated is True
>>> (GNAT's I have used would silently fail to actually free the TCB!
>>> resulting in an insidious memory leak).
>>
>> Oops, I forgot to add that I'd aborted the task first (as Dmitry said,
>> it's not always possible to arrange a clean shutdown).
> 
> Hm, would it be a usable idea for say the memory manager for an OS,
> such that the requests to the manager from programs (and perhaps even
> compilers) are delegated to the task; after all you don't want to shut
> the memory-manager down (terminate the task) at any point in normal
> operation.

The issue has nothing to do with memory management. The actual problems
are:

1. The procedure of destruction of the objects having task components.
Tasks are completed *before* Finalize is called. Ada's approach to
construction/destruction is very much broken. This is just one example of
this.

2. The usage of the terminate alternative which cannot be mixed with for
example the delay alternative.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  parent reply	other threads:[~2011-07-13  7:41 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
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 [this message]
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