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!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Natasha Kerensikova Newsgroups: comp.lang.ada Subject: Re: Termination of periodic tasks Date: Tue, 17 Jun 2014 09:00:47 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Injection-Date: Tue, 17 Jun 2014 09:00:47 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="76a49b86bc3e16725b7cfca3d85cb4c8"; logging-data="18772"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19U4+Mracs5ru7a2LpxfCIJ" User-Agent: slrn/1.0.1 (FreeBSD) Cancel-Lock: sha1:pxJbDjiPPuU2FAJi8KajRiSYvIs= Xref: news.eternal-september.org comp.lang.ada:20391 Date: 2014-06-17T09:00:47+00:00 List-Id: Hello, On 2014-06-17, Dmitry A. Kazakov wrote: > [...] > ------------------------------------------------------- > with Ada.Text_IO; use Ada.Text_IO; > with Workers; use Workers; > > procedure Test is > X : Manager; > begin > delay 5.0; > Put_Line ("Good bye!"); > end Test; > ----------------------------------------------------- > > X is finalized before Workers (and Worker_Ptr), so it does not wait for all > instances to terminate. As far as I can tell from my experimentations, this only works because Test here is a procedure. The code I linked on github a few posts ago also works fine that situation, since procedure-wide Cron_Entry objects are finalized, and when the last one is finalized the tasks terminates. The problem I'm trying to work around is when your X here is declare in a package rather than a procedure: with Workers; use Workers; package Test_Library is procedure Hello; X : Manager; end Test_Library; with Ada.Text_IO; use Ada.Text_IO; package body Test_Library is procedure Hello is begin Put_Line ("Library procedure called"); end Hello; end Test_Library; with Ada.Text_IO; use Ada.Text_IO; with Test_Library; use Test_Library; procedure Test_Main is begin Hello; delay 5.0; Put_Line ("Good bye!"); end Test_Main; Now there you get the catch-22 situation I'm hoping to solve (or failing that, document). Thanks for your help, Natasha