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,8ee36bc9f5f21359 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Need a Sanity Check References: <1115772555.000422.205200@f14g2000cwb.googlegroups.com> In-Reply-To: <1115772555.000422.205200@f14g2000cwb.googlegroups.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Wed, 11 May 2005 03:19:01 GMT NNTP-Posting-Host: 4.240.242.78 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.pas.earthlink.net 1115781541 4.240.242.78 (Tue, 10 May 2005 20:19:01 PDT) NNTP-Posting-Date: Tue, 10 May 2005 20:19:01 PDT Xref: g2news1.google.com comp.lang.ada:10990 Date: 2005-05-11T03:19:01+00:00 List-Id: autstspe wrote: > Hello. I'm seeing some strange behavior from an Ada95 program. I've > spoken to several people I work with and we all agree it should not > behave the way it does. Its a simple program so I was wondering if > someone could take a look at the following an tell me what the output > should be. It should take just a minute. Unfortunately, due to > restrictions, I can't say much more. Thanks. > > ========================================================================== > package T123_Pack is > > task type Three_Entries_Type is > entry Start ; > entry One ; > entry Two ; > entry Three ; > end Three_Entries_Type ; > > Three_Entries : Three_Entries_Type ; > > procedure Start ; > > end T123_Pack ; > -------------------------------------- > with Text_Io ; > package body T123_Pack is > > task body Three_Entries_Type is > > begin > > accept Start ; > > Text_Io.Put_Line("Start"); > > loop > > select > > accept One do > > Text_Io.Put_Line("One"); > > end ; > > or > > accept Two do > > Text_Io.Put_Line("Two"); > > end ; > > or > > accept Three do > > Text_Io.Put_Line("Three"); > > end ; > > loop > null ; > delay(0.02); > end loop ; > > end select ; -- select > > end loop ; > > end Three_Entries_Type ; > > procedure Start is > > begin > Three_Entries.Start ; > end ; > > end T123_Pack ; > > -------------------------------------- > -- main procedure > -------------------------------------- > with T123_Pack ; > > procedure T123 is > > begin > > T123_Pack.Three_Entries.Start ; > T123_Pack.Three_Entries.Three ; > T123_Pack.Three_Entries.One ; > > loop > T123_Pack.Three_Entries.Three ; > T123_Pack.Three_Entries.Two ; > delay(0.02) ; > end loop ; > > end T123 ; Your task will accept Start and output "Start". Then it will accept Three and output "Three". Then it goes into an infinite loop. Meanwhile, your main procedure is waiting for the task to accept One. The consequences should be obvious. -- Jeff Carter "All citizens will be required to change their underwear every half hour. Underwear will be worn on the outside, so we can check." Bananas 29