From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,cd2c81bea5127375 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!club-internet.fr!feedme-small.clubint.net!feeder1-1.proxad.net!proxad.net!feeder2-2.proxad.net!212.27.60.64.MISMATCH!cleanfeed3-b.proxad.net!nnrp15-1.free.fr!not-for-mail From: Samuel Tardieu Newsgroups: comp.lang.ada Subject: Re: Starting a Task and Immediately Returning References: <2ec689f1-8dc6-4cd8-b7f8-d0b7311317cc@h23g2000prf.googlegroups.com> <811556bd-60c9-43c0-927d-0e5d093dcfbd@i18g2000prf.googlegroups.com> Date: Sat, 15 Nov 2008 13:04:29 +0100 Message-ID: <877i75urea.fsf@willow.rfc1149.net> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:idtqiWgy2BgrZNPTI/e2szwCvhc= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Leafnode-NNTP-Posting-Host: 2001:6f8:37a:2::2 Organization: Guest of ProXad - France NNTP-Posting-Date: 15 Nov 2008 13:05:01 MET NNTP-Posting-Host: 91.121.19.179 X-Trace: 1226750701 news-4.free.fr 12765 91.121.19.179:33808 X-Complaints-To: abuse@proxad.net Xref: g2news2.google.com comp.lang.ada:8414 Date: 2008-11-15T13:05:01+01:00 List-Id: >>>>> "Jean-Pierre" == Jean-Pierre Rosen 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/