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,4bd6ca8f7a1eb225 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.16.106 with SMTP id f10mr4658256pbd.8.1322667455701; Wed, 30 Nov 2011 07:37:35 -0800 (PST) Path: lh20ni45073pbb.0!nntp.google.com!news1.google.com!postnews.google.com!s4g2000yqk.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Class with task destructor Date: Wed, 30 Nov 2011 07:36:14 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <30604696.94.1322013045135.JavaMail.geo-discussion-forums@yqzz20> <24938373.1788.1322615481874.JavaMail.geo-discussion-forums@yqjo5> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1322667374 12933 127.0.0.1 (30 Nov 2011 15:36:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 30 Nov 2011 15:36:14 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s4g2000yqk.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: news1.google.com comp.lang.ada:19265 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-11-30T07:36:14-08:00 List-Id: On Nov 30, 12:35=A0am, Simon Wright wrote: > "Rego, P." writes: > >> You ought to wait until the task has terminated before freeing it. > > > How could I wait for the task termination? > > Could be something like > > > =A0 =A0procedure Destruct (T : access Test_Class) is > > =A0 =A0 =A0 T_Ptr : Test_Class_Ptr :=3D Test_Class_Ptr (T); > > =A0 =A0begin > > =A0 =A0 =A0 T.Primary.Finish; > > =A0 =A0 =A0 DelayUntilTaskTermination (T_Ptr.Primary); > > =A0 =A0 =A0 Free (T_Ptr); > > =A0 =A0end Destruct; > > > ? But is there some package with something like it? > > =A0 =A0while not T_Ptr.Primary'Terminated loop > =A0 =A0 =A0 delay 0.001; > =A0 =A0end loop; Is it just me, or are there others who think that resorting to code like this is ... well, icky? I mean, if we were waiting on some external device that didn't have a mechanism for communicating back, we might have no choice other than to poll. But here we're waiting on a task that's part of the same program, and written in the same language, and we have to resort to polling to get things to work. This seems to be a clear sign that some synchronization feature is missing from the language---either having Unchecked_Deallocation block until designated tasks terminate, and/or some other synchronization mechanism. -- Adam -- Adam