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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!cleanfeed2-a.proxad.net!nnrp3-1.free.fr!not-for-mail From: Jean =?iso-8859-1?q?Fran=E7ois?= Martinez Subject: Re: Select then abort can fail to abort the abortable part Newsgroups: comp.lang.ada References: <546e5862$0$1628$426a34cc@news.free.fr> User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 20 Nov 2014 22:55:38 GMT Message-ID: <546e716a$0$2382$426a34cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 20 Nov 2014 23:55:38 CET NNTP-Posting-Host: 82.225.39.24 X-Trace: 1416524138 news-4.free.fr 2382 82.225.39.24:46422 X-Complaints-To: abuse@proxad.net Xref: news.eternal-september.org comp.lang.ada:23587 Date: 2014-11-20T23:55:38+01:00 List-Id: On Thu, 20 Nov 2014 13:36:25 -0800, Adam Beneschan wrote: > On Thursday, November 20, 2014 1:08:51 PM UTC-8, Jean François Martinez > wrote: > >> Is this incorrect behavior? > > I believe it's incorrect behavior only if a compiler supports Annex D > (because then section D.6 about Preemptive Abort must apply). If a > compiler doesn't support Annex D, then an abortable part must be aborted > only at certain "abort completion points" as defined by 9.8(16-19); if > the code keeps running without reaching any of those points, it doesn't > have to abort. > Actually Gnat is supposed to support Annex D but in Linux there are several units of it marked as non implementable on Linux. I have looked in the ARM both for delay and select then abort and there is nothing or at least I have seen nothing. > My understanding is that Windows native compilers can't really support > Annex D because the OS makes it difficult to abort a thread in the > needed way. On Unix/Linux, a timer could be set up that causes a > signal; however, my experience with Unix/Linux signals is that it's easy > to get yourself hosed, if a signal happens to occur at an inopportune > time, or another signal happens while one signal is being handled so > that there's a danger that the signal might get lost. So while I have > no idea whether GNAT for Linux claims to support Annex D, it would be > understandable to me that it wouldn't. > > A workaround is to put "delay 0.0" at strategic points in your code, > since that's an abort completion point. It would essentially poll to > see if the delay in the SELECT has expired. GNAT also has a Polling > pragma, at least for Windows, but maybe it works on Linux too. > Actually I was thinking about using timing events: inserting delays in the code is difficult: simple solutions like checking every N prime numbers found do not work since finding an new one is far longer at 100 million than at ten thousand. Checking every N tests is ugly and heavy. --- Jean-François Martinez