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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no 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.56.163 with SMTP id b3mr1364445pbq.0.1322720977277; Wed, 30 Nov 2011 22:29:37 -0800 (PST) Path: lh20ni49451pbb.0!nntp.google.com!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!newsfeed1.swip.net!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Class with task destructor Date: Thu, 01 Dec 2011 07:28:34 +0100 Organization: A noiseless patient Spider Message-ID: References: <30604696.94.1322013045135.JavaMail.geo-discussion-forums@yqzz20> <24938373.1788.1322615481874.JavaMail.geo-discussion-forums@yqjo5> Mime-Version: 1.0 Injection-Date: Thu, 1 Dec 2011 06:28:32 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="cJo7kSTQUrCFv2/D8KKtqw"; logging-data="3208"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+x3D8Frj60AfIG+AcUEZdI" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: Cancel-Lock: sha1:40K0ma7psUoyGCAJrM6vaAZKkhQ= Xref: news1.google.com comp.lang.ada:19279 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: 2011-12-01T07:28:34+01:00 List-Id: Le 01/12/2011 01:35, Randy Brukardt a �crit : > "Dmitry A. Kazakov" wrote in message >> I am using polling for T'Terminated after the rendezvous. > > That's the Ada 83 solution, and there really isn't anything better in the > language. Not sure if there even could be (I'm not a top-level expert on > real-time issues, beyond what the Janus/Ada runtime does). > There is a simple solution that I suggested a couple of days ago, but it seems it didn't to make it to the NG. Sorry if you see it twice... Put an entry (say "Termination_Wait") in the waited task, and never accept it. Call Termination_Wait from the waiting task. When the waiting task receives Tasking_Error, the waited task is terminated (well, completed, but that should be close enough). Benefit: works in all circumstances, even if the waited task is aborted or terminates due to exception. No race condition. Drawback: requires cooperation from the waited task (extra entry), therefore not applicable to tasks that you didn't write yourself. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Adalog a d�m�nag� / Adalog has moved: 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00