comp.lang.ada
 help / color / mirror / Atom feed
* Termination of periodic tasks
@ 2014-06-15 10:10 Natasha Kerensikova
  2014-06-15 12:11 ` Dmitry A. Kazakov
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Natasha Kerensikova @ 2014-06-15 10:10 UTC (permalink / raw)


Hello,

I'm still struggling with the termination of tasks hidden in the private
part or the body of libraries, this time with a periodic task.

Basically, I'm looking for a way to have some subprogram called at
roughly regular intervals. Ada.Real_Time.Timing_Events would be
functionally what I needed, except it's accuracy is vastly more than I
need, so it's overhead is mostly wasted.

For the uses I currently have in mind, the periodic subprogram would
be a kind of GC for slowly moving resources, called every 15 min to
every day, with a time tolerance exceeding minutes.

While in GNARL Ada.Real_Time.Timing_Events is implemented using a task
awaken every 100 ms.

And same as before, the task should be able to terminate quickly when
the program terminates.

I would be perfectly happy with something like:

   task body Periodic_Task is
      loop
         select
            delay 86_400.0;
         or
            terminate;
         end select;

         Periodic_Subprogram;
      end loop;
   end task;

Except that's not available in Ada.

The "or terminate" part is only available when waiting for an entry, but
this only move the problem to the periodic calling of the entry.

A timed select to wait for an entry that exists the loop would be fine
too, but how can I detect program termination to call the entry?
Could something be worked with a user-defined Finalize?

I looked at how GNARL is doing it, but it's using an RL-specific
primitive to move the task one level above the main master, so that it's
aborted instead of waited-for on program termination. I'm a bit
reluctant to use a RL-internal primitive...

That leaves Ada.Real_Time.Timing_Events and its comparatively large
overhead, even though (I think) I can afford it, it's not very
satisfying.

How would you do it?


Thanks in advance for your help,
Natasha

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2014-06-18  7:32 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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