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=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: Sat, 25 Oct 2014 17:24:02 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <0ad95e3c-de3c-4ff2-96e3-76b065117cab@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Sun, 26 Oct 2014 00:23:58 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="206f88a41f45fc94d25d07d064d738e2"; logging-data="3666"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XzTUTXgylWDUCMEM2Upr6JsSrq51olcA=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: <0ad95e3c-de3c-4ff2-96e3-76b065117cab@googlegroups.com> Cancel-Lock: sha1:VZJjg61tN1D0pIg+BfQxJOl5Cnk= Xref: news.eternal-september.org comp.lang.ada:22737 Date: 2014-10-25T17:24:02-07:00 List-Id: On 10/25/2014 04:55 PM, compguy45@gmail.com wrote: > i am trying here to increase by 1 in accept block and execute until its 75... > why variable k doesnt keep its increased value once accept block is done? > > 18 task body Counter_Task is > 19 V : Integer := 0; > 20 begin > 21 loop > 22 select > 23 accept Get (Check : Integer ; Value : out Integer) do > 24 -- put("Value of Check is "); put(Check);new_line; > 25 V := Check; > 26 V := V + 1; > 27 Value := V; > 28 put("Value V the accept block is ");put(V);new_line; > 29 end Get; > 30 or > 31 terminate; > 32 end select; > 33 end loop; > 34 end Counter_Task; > 36 begin > 37 i := 0; > 38 k := 0; > 39 delay 1.00; > 40 while k /= 75 loop > 41 p.Get(i,k); This effectively does K := I + 1; and I never changes. In another post: > 23 accept Get (Value : out Integer) do > 24 put("Value of parametar passed in is ");put(Value); > --Why am i getting zero printed??? Nothing is passed in. Value is an out parameter of a pass-by-copy type. It begins with an undefined value, and its value at the end of the accept is copied into the actual parameter. -- Jeff Carter "Your mother was a hamster and your father smelt of elderberries." Monty Python & the Holy Grail 06