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 X-Google-Thread: 103376,4fe0da28a190b761 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.germany.com!news.musoftware.de!wum.musoftware.de!news.weisnix.org!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Storage management Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <87fxmbog1u.fsf@mid.deneb.enyo.de> <87abciurrl.fsf@mid.deneb.enyo.de> <13hpf6ht4tl2m$.1su6rgr67eb2o$.dlg@40tude.net> <49140215$0$23600$4f793bc4@news.tdc.fi> Date: Fri, 7 Nov 2008 10:20:00 +0100 Message-ID: <1pqpgcv6v4qxq$.1wkkgkw2yncf.dlg@40tude.net> NNTP-Posting-Date: 07 Nov 2008 10:20:00 CET NNTP-Posting-Host: 45074a93.newsspool4.arcor-online.net X-Trace: DXC=ljlQ;@boZ\?d8Nb@@ZG@b=4IUKkg2gg;]g^Y5Hj0 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:2608 Date: 2008-11-07T10:20:00+01:00 List-Id: On Fri, 07 Nov 2008 11:54:05 +0200, Niklas Holsti wrote: > Dmitry A. Kazakov wrote: >> I have a general question. Does anybody use abort >> and asynchronous transfer of control? > > I do, to set a limit on the running time of a possibly lengthy > procedure Analyse: > > select > delay Opt.Max_Analysis_Time; > Output.Error ("Maximum analysis time exceeded."); > then abort > Analyse; > end select; That does not look like a good example. In such cases there would be some GUI with progress indication stuff, etc. I mean that most likely Analyse would periodically call something in order to indicate its state; store the results etc. These would be natural candidates to abort it "cooperatively," through an exception propagation. I think that abort/ATC as a language feature just does not hold with Ada's level of safety. >> After all, there is no chance to have them reasonably working anyway. > > It seems to work for me (GNAT 3.15p), except that I had to add a > dummy "delay 0.1" at the end of the main subprogram. Otherwise the > program would sometimes hang indefinitely in the termination phase. > This program has no tasks, so the abort and ATC are the only form > of concurrency. The example I meant was to cancel Get_Line. It worked once in 3.15p under Windows, if I correctly remember. It does not work now. And there is absolutely no guaranty that it will ever work. I honestly believe that the only case that may justify abort/ATC is cancellation of an outstanding blocking I/O. But exactly this case is not guaranteed to work, or rather is guaranteed not to work... >> How about to remove that stuff altogether and make a far more important >> finalization right and fast? > > Isn't pragma Restrictions (No_Select_Statements) enough? Or is it > too strong, and a new restriction specifically for ATC would be better? I would prefer pragma Cancelable put on a task. If a task is not cancelable then abort would raise Tasking_Error, and an ATC in the task body would be a compile-time error. All tasks would be non-cancelable per default. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de