comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Termination of periodic tasks
Date: Sun, 15 Jun 2014 14:11:26 +0200
Date: 2014-06-15T14:11:26+02:00	[thread overview]
Message-ID: <15s5htdsh301u$.zuvo5adhkxjv$.dlg@40tude.net> (raw)
In-Reply-To: slrnlpqs89.i0l.lithiumcat@nat.rebma.instinctive.eu

On Sun, 15 Jun 2014 10:10:20 +0000 (UTC), Natasha Kerensikova wrote:

[...]
> How would you do it?

You have an exit event (protected object) fired from the Finalize of the
object containing a pointer to the task (task component would not work).

The task does a timed entry call for the event. From the delay alternative
it calls the worker subprogram. When the entry gets accepted the task
exits.

After Finalize fires the event. It awaits task termination (doing tight
polling of T'Terminated) and then calls to Unchecked_Deallocate of the task
pointer.

Typically for this active object pattern the task would have a class-wide
access discriminant of the object. The worker subprogram would be a
primitive operation of the object. So the call from the task body were
dispatching.

When the type is derived from and Finalize gets overridden, the task shall
be stopped *before* doing the object's finalization. This is the rationale
for the design of task-components awaited before entering Finalize. Without
an active terminate alternative that does not work. And to have a terminate
alternative is close to impossible in any realistic design. So, the task
components must be pointers.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2014-06-15 12:11 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 [this message]
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
replies disabled

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