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,FREEMAIL_FROM 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 Path: g2news1.google.com!postnews.google.com!1g2000prd.googlegroups.com!not-for-mail From: sjw Newsgroups: comp.lang.ada Subject: Re: Starting a Task and Immediately Returning Date: Sat, 15 Nov 2008 07:53:02 -0800 (PST) Organization: http://groups.google.com Message-ID: <03f4c625-a2a8-40aa-8a85-2915c3182279@1g2000prd.googlegroups.com> References: <2ec689f1-8dc6-4cd8-b7f8-d0b7311317cc@h23g2000prf.googlegroups.com> <811556bd-60c9-43c0-927d-0e5d093dcfbd@i18g2000prf.googlegroups.com> <877i75urea.fsf@willow.rfc1149.net> NNTP-Posting-Host: 62.49.19.209 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1226764382 21254 127.0.0.1 (15 Nov 2008 15:53:02 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 15 Nov 2008 15:53:02 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 1g2000prd.googlegroups.com; posting-host=62.49.19.209; posting-account=_RXWmAoAAADQS3ojtLFDmTNJCT0N2R4U User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:2688 Date: 2008-11-15T07:53:02-08:00 List-Id: On Nov 15, 12:04=A0pm, Samuel Tardieu 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.