comp.lang.ada
 help / color / mirror / Atom feed
From: Natasha Kerensikova <lithiumcat@instinctive.eu>
Subject: Re: Termination of periodic tasks
Date: Tue, 17 Jun 2014 09:00:47 +0000 (UTC)
Date: 2014-06-17T09:00:47+00:00	[thread overview]
Message-ID: <slrnlq00tr.i0l.lithiumcat@nat.rebma.instinctive.eu> (raw)
In-Reply-To: a1wv6jbm09et.1x4jn9fg3e0ds.dlg@40tude.net

Hello,

On 2014-06-17, Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> 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

  reply	other threads:[~2014-06-17  9:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-15 10:10 Termination of periodic tasks Natasha Kerensikova
2014-06-15 12:11 ` Dmitry A. Kazakov
2014-06-15 15:23 ` J-P. Rosen
2014-06-16 13:54   ` Natasha Kerensikova
2014-06-17 20:14     ` Charles H. Sampson
2014-06-18  7:32       ` Dmitry A. Kazakov
2014-06-15 16:54 ` Jeffrey Carter
2014-06-16 14:02   ` Natasha Kerensikova
2014-06-16 15:08     ` Dmitry A. Kazakov
2014-06-16 17:08     ` Jeffrey Carter
2014-06-17  6:57       ` Natasha Kerensikova
2014-06-17  7:37         ` Dmitry A. Kazakov
2014-06-17  7:47           ` Natasha Kerensikova
2014-06-17  8:45             ` Dmitry A. Kazakov
2014-06-17  9:00               ` Natasha Kerensikova [this message]
2014-06-17 12:55                 ` Dmitry A. Kazakov
2014-06-17 14:51                   ` J-P. Rosen
2014-06-17 16:44                     ` Dmitry A. Kazakov
2014-06-17 20:00                       ` Randy Brukardt
2014-06-17 20:16                         ` Jeffrey Carter
2014-06-17 21:30                         ` Simon Wright
2014-06-17 12:02         ` Jacob Sparre Andersen
2014-06-17 19:32           ` Natasha Kerensikova
2014-06-17 17:53         ` Jeffrey Carter
2014-06-17 20:03           ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox