comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adambeneschan@gmail.com>
Subject: Re: Select then abort can fail to abort the abortable part
Date: Thu, 20 Nov 2014 13:36:25 -0800 (PST)
Date: 2014-11-20T13:36:25-08:00	[thread overview]
Message-ID: <e9dfeead-b7a8-48d0-831e-30dad054145e@googlegroups.com> (raw)
In-Reply-To: <546e5862$0$1628$426a34cc@news.free.fr>

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.  

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.

See this earlier thread: https://groups.google.com/forum/?hl=en#!searchin/comp.lang.ada/D.6$20AND$20after$3A2013$2F01$2F01$20AND$20before$3Atoday%7Csort:relevance/comp.lang.ada/748DRqqa7v0/llYfPx731ucJ

                                -- Adam


  parent reply	other threads:[~2014-11-20 21:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20 21:08 Select then abort can fail to abort the abortable part Jean François Martinez
2014-11-20 21:35 ` Dmitry A. Kazakov
2014-11-20 22:19   ` Jean François Martinez
2014-11-21  8:37     ` Dmitry A. Kazakov
2014-11-21 15:26       ` Jean François Martinez
2014-11-20 21:36 ` Adam Beneschan [this message]
2014-11-20 22:55   ` Jean François Martinez
replies disabled

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