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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.70.44.230 with SMTP id h6mr3702472pdm.7.1405620741197; Thu, 17 Jul 2014 11:12:21 -0700 (PDT) X-Received: by 10.50.111.232 with SMTP id il8mr2345igb.6.1405620740917; Thu, 17 Jul 2014 11:12:20 -0700 (PDT) Path: border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!h18no1731307igc.0!news-out.google.com!bp9ni941igb.0!nntp.google.com!h18no3202566igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 17 Jul 2014 11:12:20 -0700 (PDT) In-Reply-To: <7581b098-ea30-4b34-a51e-2f0dd5a57563@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=KSa2aQoAAACOxnC0usBJYX8NE3x3a1Xq NNTP-Posting-Host: 66.126.103.122 References: <50bdb713-7ce1-411b-810b-9bdee1d26b7a@googlegroups.com> <7581b098-ea30-4b34-a51e-2f0dd5a57563@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8e1281ee-79b4-4878-91db-6d0a65c96013@googlegroups.com> Subject: Re: Timeouts in Ada From: Adam Beneschan Injection-Date: Thu, 17 Jul 2014 18:12:20 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: number.nntp.dca.giganews.com comp.lang.ada:187659 Date: 2014-07-17T11:12:20-07:00 List-Id: On Thursday, July 17, 2014 9:46:04 AM UTC-7, NiGHTS wrote: > Your answer was highly intuitive, so thank you for your careful explanati= on.=20 Glad it helped.=20 >=20 > So even if the entry call takes an hour, it will still wait the full hour= until it completes before entering the "or delay" section? This is what I = am understanding so far. If the entry is *selected* right away, but the rendezvous takes an hour (i.= e. the body of the ACCEPT statement just sits there), then yes, the code wi= ll wait. Normally, a rendezvous that could wait an hour shouldn't be writt= en. I think the idea is that rendezvous should be completed fairly quickly= . > Also, can two entry calls be placed like this?=20 >=20 > select call_1(params) > ... > or call_2(params) > ... > or delay 10 > ... > end select No. See my comments below. > If so, how would it know which finishes first without having them run con= currently? Don't see a point in having them run one after the other. If this statement *were* implemented, it would choose whichever entry call = became *available* first. Then when one of them, say call_2, became availa= ble, it would cancel all the other entry calls, wait for the call_2 rendezv= ous to complete, and execute the sequence of statements after the call_2. = In theory, this shouldn't need anything to "run concurrently". The current= task would go into a wait state, and the tasking implementation would have= a list of entries the task was waiting for, and the implementation would w= ake it up as soon as one of those entries could be selected. In practice, however, apparently it's too complicated to implement. I don'= t know the details. It may be that it's too hard to implement when combina= tions of features are used. In any case, the language designers considered= adding this ability (SELECT on multiple entries), but decided against it. =20 > I have also seen the select used with an "else". What exactly is the diff= erence between "or" and "else"? Is "else" used when a "delay" is not involv= ed? Otherwise I don't see the point in the "else" path. ELSE is pretty much the same as OR DELAY 0.0;. It selects the entry if it = happens to be available right away (in which case it waits for the rendezvo= us to complete, then executes any other statements after the entry call). = Otherwise it gives up immediately and jumps right to the sequence of statem= ents after the ELSE. Note that, unlike OR, the first statement after ELSE = is not special and can be any Ada statement. -- Adam