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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Finalization of library level tasks Date: Wed, 25 Apr 2018 18:49:13 -0500 Organization: JSA Research & Innovation Message-ID: References: <702e2422-a93f-4200-9749-5122c3d0f899@googlegroups.com> <5b681276-7224-4fb3-b950-ffe03b3326d4@googlegroups.com> Injection-Date: Wed, 25 Apr 2018 23:49:14 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="22177"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:51713 Date: 2018-04-25T18:49:13-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:pb0bho$p1e$1@gioia.aioe.org... > On 2018-04-15 21:32, Egil H H wrote: >> On Sunday, April 15, 2018 at 7:40:38 PM UTC+2, Dmitry A. Kazakov wrote: >>> >>> Terminate alternative is almost always useless because it cannot be >>> mixed with "else" or "delay". If there were a way to check within the >>> task if its completion has been requested >> >> For library level tasks: >> >> loop >> select >> accept Some_Rendezvous; >> or >> delay Some_Interval; >> end select; >> exit when not Ada.Task_Identification.Is_Callable >> (Ada.Task_Identification.Environment_Task); >> end loop; > > Yes, that is what I was looking for. T'Callable on the task itself does > the trick. Apparently task being terminated is not callable. Callable becomes False when a task is completed. That happens before finalization and before termination. The environment task completes when the main subprogram exits, and you can test that as above. Randy.