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!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Finalization of library level tasks Date: Thu, 19 Apr 2018 08:34:47 +0100 Organization: A noiseless patient Spider Message-ID: References: <04f19a56-7fab-416e-8ec0-b9a73e239e90@googlegroups.com> <17f48c2e-3b2d-434d-b2a2-d2c1a5aea5a8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="8e7cc66aa52019c1844018de7145f218"; logging-data="27865"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hlk+Zk7moHl6X/uSsXqWz7RNGgKkB9u0=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:xp92CB0pCmv/Nvz2aEeHOMzptHc= sha1:G6Qu9t0RlmIH5d4UbTX5mrtHmSk= Xref: reader02.eternal-september.org comp.lang.ada:51629 Date: 2018-04-19T08:34:47+01:00 List-Id: AdaMagica writes: > Am Mittwoch, 18. April 2018 16:52:04 UTC+2 schrieb J-P. Rosen: >> OK. You were actually quite close... Use a killer task (with the same >> master as your worker) like this: >> >> task Killer is >> entry Never_Called; >> end Killer; >> >> task body Killer is >> begin >> accept Never_Called; >> exception >> when Tasking_Error => >> -- Kill the other task >> end Killer; >> >> Hint: when the master completes, Tasking_Error is raised in all tasks >> waiting on entries that depend on that master. > > I do not understand how this is supposed to work. I tried this: with Killer_Pack; procedure Killing is begin null; end Killing; package Killer_Pack is task Killer is entry Never_Called; end Killer; end Killer_Pack; with GNAT.IO; package body Killer_Pack is task body Killer is begin accept Never_Called; exception when Tasking_Error => GNAT.IO.Put_Line ("bye."); end Killer; end Killer_Pack; with all the GNATs I could lay my hands on (macOS) and they all hang: under gdb, (gdb) info tasks ID TID P-ID Pri State Name * 1 101000000 31 Child Termination Wait main_task 2 101000e00 1 31 Accept or Select Term killer Of course, I'm quite prepared to believe I've misunderstood the point.