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-Language: ENGLISH,CP1252 Path: g2news1.google.com!postnews.google.com!r24g2000yqd.googlegroups.com!not-for-mail From: sjw Newsgroups: comp.lang.ada Subject: Re: Private or public task ? Date: Fri, 5 Feb 2010 14:57:28 -0800 (PST) Organization: http://groups.google.com Message-ID: <1c3d207d-a815-48cd-b3e5-632a78992b91@r24g2000yqd.googlegroups.com> References: <1rvjt99u2jqa8.1okqcvf62hlc8$.dlg@40tude.net> <494a3592-421b-4a08-9505-f4c9b2cdce43@a32g2000yqm.googlegroups.com> NNTP-Posting-Host: 82.30.110.254 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1265410648 5742 127.0.0.1 (5 Feb 2010 22:57:28 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 5 Feb 2010 22:57:28 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r24g2000yqd.googlegroups.com; posting-host=82.30.110.254; posting-account=_RXWmAoAAADQS3ojtLFDmTNJCT0N2R4U User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:8928 Date: 2010-02-05T14:57:28-08:00 List-Id: On Feb 5, 10:09=A0pm, Hibou57 (Yannick Duch=EAne) wrote: > On 5 f=E9v, 22:40, "Dmitry A. Kazakov" > > If you want garbage collection because of pointers involved then just d= o > > it. Don't break the task interface, make a handle type pointing to the = task > > object. When the last handle vanishes, deallocate the task. That is. > > =93 Deallocate the task =94 ? If I want to deallocate, I have to request > it to completes, and for the latter, I need it to have a corresponding > request entry... which would need to be public (as private entry > accessible from implementation is not possible). You could just abort the task before freeing it. With GNAT (maybe just with older versions, maybe not on all platforms), if you free a task before it has terminated it will silently not do the deallocation. The trick is to loop until 'Terminated is True. I had to create a scavenger task; tasks that had been aborted were placed on a queue for the scavenger task to free when the task had terminated. Fairly gruesome generics involved.