comp.lang.ada
 help / color / mirror / Atom feed
From: sjw <simon.j.wright@mac.com>
Subject: Re: Starting a Task and Immediately Returning
Date: Sat, 15 Nov 2008 07:53:02 -0800 (PST)
Date: 2008-11-15T07:53:02-08:00	[thread overview]
Message-ID: <03f4c625-a2a8-40aa-8a85-2915c3182279@1g2000prd.googlegroups.com> (raw)
In-Reply-To: 877i75urea.fsf@willow.rfc1149.net

On Nov 15, 12:04 pm, Samuel Tardieu <s...@rfc1149.net> wrote:

> ...and deallocating all the space used by a task in Ada is often a
> no-no when you use a long-lived task type, as you need to be able
> to query 'Terminated on a former task object at any time after the
> task has terminated, so some information has to remain (the task
> status) or some arbitrary limit has to be set (use a unique counter
> when creating a task and a bitmap to indicate the termination
> status, forbidding you to reuse a task "number" since the status
> has to live forever). Both are bad in a system which is expected
> to run forever.
>
> A solution would be for a compiler to make task types a reference
> counted type so that the runtime knows when 'Terminated can be
> called or not. I haven't checked if this is what GNAT does.

The way GNAT works, I believe -- and possibly not on all OSs -- is
that attempts to deallocate a task that isn't terminated are silently
ignored. On the other hand, it seems that deallocating a task which is
terminated does the right thing.

You clearly need to be able to ask a declared task whether it's
terminated at any time, but I don't see why that would apply to
allocated tasks? 'Terminated on a dangling pointer (deallocated
elsewhere) would be no worse than any other reference through such a
pointer.



      reply	other threads:[~2008-11-15 15:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-14 13:26 Starting a Task and Immediately Returning Graham Stark
2008-11-14 13:41 ` Maciej Sobczak
2008-11-14 15:13   ` Jean-Pierre Rosen
2008-11-15 12:04     ` Samuel Tardieu
2008-11-15 15:53       ` sjw [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox