comp.lang.ada
 help / color / mirror / Atom feed
From: Bojan Bozovic <bozovic.bojan@gmail.com>
Subject: Re: multiple delay alternative
Date: Sun, 4 Mar 2018 20:08:23 -0800 (PST)
Date: 2018-03-04T20:08:23-08:00	[thread overview]
Message-ID: <0c90fa0c-4b3d-4c96-b6c6-5c72bdcf2866@googlegroups.com> (raw)
In-Reply-To: <90838aa0-bd51-4913-b0cf-1ded5024c151@googlegroups.com>

On Sunday, March 4, 2018 at 7:22:58 PM UTC+1, Mehdi Saada wrote:
> Hello !
> 
> In https://perso.telecom-paristech.fr/pautet/Ada95/chap28.htm, Ada tutorial's paragraph on the delayed rendezvous, it says the general form of this construct is:
> select 
>          delay <time>;
>          <entry call>;
>     or 
>          delay <time>;
>          <entry call>;
>     or
>          delay <time>;
>          <entry call>;
>     end select;
> 
> But in the RM timed entry calls are featured like this:
> timed_entry_call ::= 
>   select
>    entry_call_alternative
>   or
>    delay_alternative
>   end select;
> 
> What should I understand ?
> I have trouble understanding the first construct, otherwise than "if nothing happens before n seconds, do that, AND THEN, if nothing happens before n2 seconds, do that, etc... as if
> select
>      delay 11.0;
>      A;
> or
>      delay 12.0
>      B;
> end select;
> 
> is equivalent to
> delay 10.0
> select
>      delay 1.0;
> or
>      delay 2.0;
> end select;
> But it's likely that I didn't guess right.

http://www.adaic.org/resources/add_content/docs/95style/html/sec_6/6-1-7.html

"The Ada language definition only guarantees that the delay time is a minimum. The meaning of a delay or delay until statement is that the task is not scheduled for execution before the interval has expired. In other words, a task becomes eligible to resume execution as soon as the amount of time has passed. However, there is no guarantee of when (or if) it is scheduled after that time because the required resources for that task might not be available at the expiration of the delay . "

Delay will simply stop execution (not schedule the task) for an amount of time until the condition needed is met, and then process the task entry. If you have both delayed and non-delayed entries for the same "accept" in "select" non-delayed will be executed (as far as I can tell).

I myself am willing to wait and see what the more experienced have to say on this matter, as AdaTutor by John J. Herro I'm using don't cover delayed task entries at all.

  parent reply	other threads:[~2018-03-05  4:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-04 18:22 multiple delay alternative Mehdi Saada
2018-03-05  0:21 ` Mehdi Saada
2018-03-05  4:08 ` Bojan Bozovic [this message]
2018-03-05 10:17   ` Robert Eachus
2018-03-05  8:15 ` Dmitry A. Kazakov
2018-03-05  9:23 ` AdaMagica
2018-03-05 10:32 ` Bojan Bozovic
2018-03-05 13:50 ` Mehdi Saada
2018-03-05 14:35   ` Dmitry A. Kazakov
2018-03-05 15:09     ` Mehdi Saada
2018-03-06 11:05       ` Dmitry A. Kazakov
2018-03-05 17:37   ` Jeffrey R. Carter
2018-03-05 23:28 ` Simon Wright
2018-03-06  0:11   ` Anh Vo
2018-03-06  1:50 ` Mehdi Saada
2018-03-06  6:00   ` Robert Eachus
2018-03-06  6:03   ` J-P. Rosen
2018-03-06 16:36   ` Jeffrey R. Carter
2018-03-06 10:31 ` Mehdi Saada
2018-03-06 11:18   ` Dmitry A. Kazakov
2018-03-06 13:43     ` Mehdi Saada
2018-03-06 15:17       ` Dmitry A. Kazakov
2018-03-06 20:06       ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox