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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,a4db0fc323f0b09e X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!goblin3!goblin1!goblin.stu.neva.ru!feeder.eternal-september.org!eternal-september.org!not-for-mail From: Reto Buerki Newsgroups: comp.lang.ada Subject: Re: Barrier re-evaluation issue with GNAT 4.3.2 Date: Mon, 28 Sep 2009 15:25:18 +0200 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: news.eternal-september.org U2FsdGVkX1/KTqRBRmHhRheWd5U+tc5q2+tXjKbvtW7JCfF9YqzpeembDB2p0L/AsKwmr25PtyKdXDEJ25cgi1j8qaY5LZ4ntZTvlL2czckyEPBThCHXRS/QdWo+j59ldc8iDnhBCig= X-Complaints-To: abuse@eternal-september.org NNTP-Posting-Date: Mon, 28 Sep 2009 13:25:07 +0000 (UTC) In-Reply-To: X-Auth-Sender: U2FsdGVkX18eVXfpVbhXEER6iIBHh6po+fMXKu6z6/Y= Cancel-Lock: sha1:QixCfZh+zEZfo4hTwL1GysoLXNs= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) Xref: g2news2.google.com comp.lang.ada:8512 Date: 2009-09-28T15:25:18+02:00 List-Id: John B. Matthews wrote: > In article , > Reto Buerki wrote: > >> John B. Matthews wrote: >>> I get the same result with FSF GNAT 4.3.4. I revised your code to follow >>> the "protected Event" example seen here: >>> >>> >>> >>> It seems to work. The compiler warns, "potentially blocking operation in >>> protected operation" in Wakeup, although the Signal barrier is always >>> true. I'm not sure the extra entries _should_ be required, but I think >>> it might be more reliable in the face of multiple threads calling Wait. >>> I don't know a reason why it wouldn't work under 4.3.2. >> Thanks for your effort in confirming the issue with GNAT 4.3.4 and for >> the "protected Event" example. > > You're welcome. > >> We will see how we can integrate your idea into our project as a >> workaround for the re-evaluation problem. > > This alternative approach also works, without using requeue: Adapting your first example worked for us! We basically just moved the Alarm_Fired assignment from Wakeup() into an extra Signal() entry: procedure Wakeup (Event : in out Timing_Events.Timing_Event) is begin Signal; end Wakeup; entry Signal when True is begin Alarm_Fired := True; end Signal; This seems to cause a re-evaluation of the protected object barriers. It does not work if Signal() is a protected procedure, it must be an entry. > I am troubled by the "potentially blocking operation" warning. Two > things make me think it may be irrelevant: 1) Signal does not actually > block, except to dequeue waiters, and 2) Wakeup, which enters Signal, is > itself a protected procedure: > > > > I'd welcome critical thoughts. We are not getting such a warning with our code, but we are not using "requeue" since our scenario is different.