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.dca3.giganews.com!backlog3.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!newsfeed.datemas.de!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Termination of periodic tasks Date: Wed, 18 Jun 2014 09:32:23 +0200 Organization: cbb software GmbH Message-ID: References: <1lndy96.or7wdo1tdxu58N%csampson@inetworld.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: QTaafVZuunHujkJPndFR7g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit 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: 2651 Xref: number.nntp.dca.giganews.com comp.lang.ada:187043 Date: 2014-06-18T09:32:23+02:00 List-Id: On Tue, 17 Jun 2014 13:14:23 -0700, Charles H. Sampson wrote: > Natasha Kerensikova wrote: > >> Hello, >> >> On 2014-06-15, J-P. Rosen wrote: >>> Le 15/06/2014 12:10, Natasha Kerensikova a écrit : >>>> And same as before, the task should be able to terminate quickly when >>>> the program terminates. >>> Why not have a "stop" entry called by the main program when it >>> terminates (possibly through an exported subprogram if you don't want to >>> have the task public)? >> >> Mostly because I believe this to be too heavy for a burden for the >> client, and somewhat of an abstraction leak. > > I'm having trouble understanding how this is too heavy. In most > programs I've written, there's a possibility of stopping. Usually the > need to stop is detected by or, most commonly, propagated to the main > program. The main program then signals all of its library packages to do > whatever is necessary for stopping. An exported Stop subprogram seems a > quite natural way to do that. That is true. I am writing a lot of code with tasking and was unaware of the issue with library level tasks. > I've even used implementations that have exported Stop subprograms > in all library packages, some of them null. That enforces the > abstractions in that the main program doesn't need to know which library > packages need to be wrapped up. I prefer a stateless design of packages with explicit objects maintaining the state, created by the client. That eliminates the problem of task termination too. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de