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: 103376,344faf475a6f812a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.182.116 with SMTP id ed20mr10317159wic.6.1366734801956; Tue, 23 Apr 2013 09:33:21 -0700 (PDT) Path: hg5ni17433wib.1!nntp.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Interresting difference in Normal-Returns/Expression-Functions and Extended-Returns. Date: Tue, 23 Apr 2013 17:33:20 +0100 Organization: A noiseless patient Spider Message-ID: References: <97967083-d21d-4de2-aeb8-76d0d5818993@googlegroups.com> Mime-Version: 1.0 Injection-Info: mx05.eternal-september.org; posting-host="759faf2487b2ffad9ca6f5463a606de4"; logging-data="17996"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/IixnNT5wPjDq2fbYzD1Ckpdo5Z7mE/Qc=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (darwin) Cancel-Lock: sha1:si1LrSKhwv7HlTfRZyHLRUBJET4= sha1:4I+EDFF6OVqKRaZmWUYRVy4Z3ro= Content-Type: text/plain Date: 2013-04-23T17:33:20+01:00 List-Id: Shark8 writes: > I recently ran into unexpected behavior in the differences between a > normal return and an extended return [in GNAT]: namely an extended > return used to generate items in an array of tasks will *ALWAYS* > execute in a sequential manner whereas the array generated with an > expression-function or normal return is executed simultaneously. > > Is there some subtle difference in the extended return that I'm > unaware of? (Is this a bug?) I'm pretty sure you've found a bug. I changed Testing to have an entry Start, and changed the body to report when the task was activated: task type Testing( Text : not null access constant String ) is entry Start; end Testing; task body Testing is D : Duration := RNG.Random; -- Get a random duration. begin Resource.Write (Text.all & " starting."); accept Start; delay D; -- Delay for that duration. -- Then print the Text for the task as well as the Delay. Resource.Write( Text.all & ASCII.HT & Duration'Image(D) ); end Testing; and changed the three test loops to start the tasks begin for T of P loop T.Start; end loop; end TEST_3; The expression function and normal return function versions were fine; the extended return function version prints TEST_3: Extended Return Function Bob starting. and hangs.