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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!buffer2.nntp.dca1.giganews.com!border2.nntp.dca3.giganews.com!backlog4.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Termination of periodic tasks Date: Sun, 15 Jun 2014 14:11:26 +0200 Organization: cbb software GmbH Message-ID: <15s5htdsh301u$.zuvo5adhkxjv$.dlg@40tude.net> References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: AuYlnUSfTZrfhAkRjyySpQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 2277 Xref: number.nntp.dca.giganews.com comp.lang.ada:186922 Date: 2014-06-15T14:11:26+02:00 List-Id: 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