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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,35862b8253794e65 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-09 09:01:21 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!cyclone.columbus.rr.com!cyclone3.kc.rr.com!news3.kc.rr.com!twister.socal.rr.com.POSTED!not-for-mail Message-ID: <3CB3105C.740A3B18@san.rr.com> From: Darren New X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Requeue References: <3CB0CD37.52B43088@yahoo.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 09 Apr 2002 16:01:00 GMT NNTP-Posting-Host: 66.75.151.160 X-Complaints-To: abuse@rr.com X-Trace: twister.socal.rr.com 1018368060 66.75.151.160 (Tue, 09 Apr 2002 09:01:00 PDT) NNTP-Posting-Date: Tue, 09 Apr 2002 09:01:00 PDT Organization: RoadRunner - West Xref: archiver1.google.com comp.lang.ada:22274 Date: 2002-04-09T16:01:00+00:00 List-Id: Anatoly Chernyshev wrote: > Could someone post a simple yet practical example of using that > statement in Ada programming? Part of the need for requeue comes from the fact that a guard can't be based on the parameters of the call. So if I want to do something like entry Save_In_Buffer(Octets : in Stream_Element_Array) when Octets'Length < My_Buffer.Remaining_Space is begin .... end Save_In_Buffer; I can't do that. Octets'Length isn't allowed in the guard. So instead I do entry Save_In_Buffer(...) when True is begin if My_Buffer.Remaining_Space < Octets'Length then requeue Save_Wait end if; ... end Save_In_Buffer; Then Save_Wait has a guard that is gets set to false whenever I put something into the buffer and true whenever I take something out. Inside Save_Wait, once you get in, you check again, and if there's still no room, you requeue once again. Ugly but it works. I'd be happy to put the code somewhere if you want to look. -- Darren New San Diego, CA, USA (PST). Cryptokeys on demand. Remember, drive defensively if you drink.