comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@mitre-bedford.arpa  (Robert I. Eachus)
Subject: Re: Delay entry selection.
Date: 4 Dec 91 01:18:08 GMT	[thread overview]
Message-ID: <EACHUS.91Dec3171808@Largo.mitre.org> (raw)

In article <2432@eonwe.gmv.es> acuenca@gmv.es (Agustin Cuenca) writes:

   Suppose the following task body;

   select 
	   accept A;
   or
	   delay 3.0;
   end select;

   Because, as I understand it, if the entry call was issued at t0+2
   seconds, the accept A shall be executed, but if it was issued at
   t0+3 seconds, the delay shall be the one selected.

   Am I missing something...

   Yes, a very subtile point about rendezvous.  A rendezvous occurs
when both tasks are ready, in the case of a call two seconds into the
delay, this occurs when the caller finally makes his call.  At this
point the rendezvous occurs with the higher of the two priorities.
Since one of these tasks (the caller) was running, the rendezvous
occurs immediately.  (It can, of course, be interrupted by a higher
priority task a nanosecond later, but the instant the rendezvous
starts is indivisible.  For you nit pickers out there, the time to
determine that a rendezvous is possible is not indivisible.)

   If the delay expires, the waiting task instantly becomes eligible
to run (whether it runs or not depends on its priority), and its entry
is no longer open for immediate rendezvous.  A caller four seconds
after the start of the delay is queued waiting for the called task to
reach another accept statement, whether or not the called task runs in
the meantime.  (Yes, it is possible to write a program to test this.
However it is the nature of such programs that they are at best
implementation dependant.)

    The rules are very deterministic.  Proving that an implementation
follows them is very tough.  :-)

--

					Robert I. Eachus

with STANDARD_DISCLAIMER;
use  STANDARD_DISCLAIMER;
function MESSAGE (TEXT: in CLEVER_IDEAS) return BETTER_IDEAS is...

                 reply	other threads:[~1991-12-04  1:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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