From: adam@irvine.com (Adam Beneschan)
Subject: Re: Overriding discriminants perplexes GNAT 3.14p
Date: 19 Sep 2002 11:22:15 -0700
Date: 2002-09-19T18:22:16+00:00 [thread overview]
Message-ID: <b4682ab7.0209191022.43137826@posting.google.com> (raw)
In-Reply-To: amc58u$4ebgo$1@ID-77047.news.dfncis.de
Dmitry A.Kazakov <mailbox@dmitry-kazakov.de> wrote in message news:<amc58u$4ebgo$1@ID-77047.news.dfncis.de>...
> 2. Circular requeue hangs at run-time under Linux:
>
> package Objects is
> protected Object1 is
> entry Point1;
> entry Point2;
> end Object1;
> protected Object2 is
> entry Point1;
> end Object2;
> end Objects;
> ------------
> package body Objects is
> protected body Object1 is
> entry Point1 when True is
> begin
> requeue Object2.Point1;
> end Point1;
> entry Point2 when True is
> begin
> null;
> end Point2;
> end Object1;
> protected body Object2 is
> entry Point1 when True is
> begin
> requeue Object1.Point2;
> end Point1;
> end Object2;
> end Objects;
> ------------
> with Ada.Text_IO; use Ada.Text_IO;
> with Objects;
>
> procedure Test is
> begin
> Objects.Object1.Point1;
> Put_Line ("That's OK");
> end Test;
I think GNAT's behavior is legitimate here. Protected entry calls and
external requeues start new "protected actions" on the target
protected object (9.5.3(8), 9.5.4(11)). Thus, when
Objects.Object1.Point1 is called, a new protected action is started on
Object1. When this requeues to Object2.Point1, a new protected action
is started on Object2; however, the protected action on Object1 does
not complete (AI95-00148). When Object2.Point1 then requeues to
Object1.Point2, it attempts to start a new protected action on
Object1. However, 9.5.1(4) says that a new protected action cannot be
"started on a protected object while another protected action on the
same protected object is underway". Thus, the requeue to
Object1.Point2 must wait until the already in-progress protected
action is completed, and that can never happen; the result is
deadlock. Note that the second requeue is not necessarily
"queued"---see 9.5.1(18).
See also 9.5.1(8-16), which says that if a protected action performs
an external requeue on the same target object as that of a protected
action (which is what your program does, indirectly), it is a bounded
error. Implementations may or may not detect this error; see
9.5.1(17).
In other words, it's your program that's in error here, not GNAT.
-- Adam
next prev parent reply other threads:[~2002-09-19 18:22 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-19 2:32 Overriding discriminants perplexes GNAT 3.14p Dmitry A.Kazakov
2002-09-18 16:45 ` Stephen Leake
2002-09-19 21:34 ` Dmitry A.Kazakov
2002-09-19 15:51 ` Stephen Leake
2002-09-20 22:06 ` Dmitry A.Kazakov
2002-09-20 12:29 ` Stephen Leake
2002-09-22 8:43 ` Dmitry A.Kazakov
2002-09-22 13:32 ` Georg Bauhaus
2002-09-23 5:41 ` Dmitry A.Kazakov
2002-09-23 12:41 ` Georg Bauhaus
2002-09-24 1:38 ` Dmitry A.Kazakov
2002-09-23 15:33 ` Stephen Leake
2002-09-24 8:35 ` Dmitry A. Kazakov
2002-09-19 18:22 ` Adam Beneschan [this message]
2002-09-20 22:06 ` Dmitry A.Kazakov
2002-09-20 16:00 ` Adam Beneschan
2002-09-22 8:43 ` Dmitry A.Kazakov
2002-09-23 21:18 ` Adam Beneschan
2002-09-24 9:40 ` Dmitry A. Kazakov
2002-09-21 13:01 ` Simon Wright
2002-09-18 16:46 ` Mark Johnson
2002-09-19 21:34 ` Dmitry A.Kazakov
2002-09-19 16:17 ` Stephen Leake
2002-09-19 20:02 ` tmoran
2002-09-20 21:10 ` Dmitry A.Kazakov
2002-09-21 12:56 ` Simon Wright
2002-09-18 16:49 ` Frank J. Lhota
2002-09-19 21:34 ` Dmitry A.Kazakov
2002-09-18 17:17 ` Per Sandbergs
2002-09-19 8:51 ` Thierry Lelegard
-- strict thread matches above, loose matches on Subject: below --
2002-09-19 9:08 Grein, Christoph
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox