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, T_FILL_THIS_FORM_SHORT autolearn=unavailable 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!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: confusion about message passing between the tasks Date: Sun, 26 Oct 2014 16:23:32 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Sun, 26 Oct 2014 23:23:28 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="206f88a41f45fc94d25d07d064d738e2"; logging-data="27436"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19K+XF21aHIM3Ko7e19C5DHCUpnmXtN5r4=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: Cancel-Lock: sha1:IUbndZ2T5GhcjyCQ70itwqa9IDY= Xref: news.eternal-september.org comp.lang.ada:22791 Date: 2014-10-26T16:23:32-07:00 List-Id: On 10/26/2014 03:27 PM, Robert A Duff wrote: > > Maybe. Here's my PO code: > > type State_Enum is (Accepting_Entry_1, Accepting_Entry_2); > > protected P is > entry Entry_1; > entry Entry_2; > private > State: State_Enum := Accepting_Entry_1; > end P; > > protected body P is > > entry body Entry_1 when State = Accepting_Entry_1 do > ... > if ... > State := Accepting_Entry_2; > end Entry_1; > > entry body Entry_2 when State = Accepting_Entry_2 do > ... > if ... > State := Accepting_Entry_1; > end Entry_2; > > end P; > > Can you show equivalent code using "accept"? I'm pretty sure entry bodies use "is", not "do". I think so. task T is pragma Passive; entry Entry_1; entry Entry_2; end T; task body T is State : State_Enum := Accepting_Entry_1; begin -- T loop select when State = Accepting_Entry_1 => accept Entry_1 do ... if ... then State := Accepting_Entry_2; end if; end Entry_1; or when State = Accepting_Entry_2 => accept Entry_2 do ... if ... then State := Accepting_Entry_1; end if; end Entry_2; or terminate; end select; end loop; end T; -- Jeff Carter "Why, the Mayflower was full of Fireflies, and a few horseflies, too. The Fireflies were on the upper deck, and the horseflies were on the Fireflies." Duck Soup 95