comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Tardieu <sam@rfc1149.net>
Subject: Re: Starting a Task and Immediately Returning
Date: Sat, 15 Nov 2008 13:04:29 +0100
Date: 2008-11-15T13:05:01+01:00	[thread overview]
Message-ID: <877i75urea.fsf@willow.rfc1149.net> (raw)
In-Reply-To: th4kfg.u0g.ln@hunter.axlog.fr

>>>>> "Jean-Pierre" == Jean-Pierre Rosen <rosen@adalog.fr> writes:

Jean-Pierre> Or more simply, create the task with an allocator
Jean-Pierre> (new). The tricky thing will be to deallocate the tasks'
Jean-Pierre> space after it is terminated. Web server are generally
Jean-Pierre> expected to run 24/7, so no memory leak allowed...

...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.

  Sam
-- 
Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/



  reply	other threads:[~2008-11-15 12:04 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 [this message]
2008-11-15 15:53       ` sjw
replies disabled

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