comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Basic question about select
Date: Wed, 28 Apr 2010 20:36:22 +0200
Date: 2010-04-28T20:36:19+02:00	[thread overview]
Message-ID: <1p2m3s7y70lsa$.79fl3we9edva$.dlg@40tude.net> (raw)
In-Reply-To: Xns9D68C41D38649fdnbgui7uhu5h8hrnuio@188.40.43.213

On Wed, 28 Apr 2010 18:16:44 +0000 (UTC), John Wilkinson wrote:

> select
>     	PID.Call;  --an entry call to task PID
>     	Status := P;
> then abort
>     	delay 10.0;
>     	Status := Q;
> end select;
> 
> Is the above valid Ada code? It's been handed to me by someone, I 
> don't really know much about Ada, and I'm supposed to understand 
> what it does. I can't find any information on "abort" or even 
> "then".

See ARM 9.7.4 Asynchronous Transfer of Control

> If it's valid, what does it do?

It waits 10s and then assigns Q to Status. But if within these 10s + the
time needed to assign Status, the task PID accepts Call, then the sequence
introduced by "then abort" is aborted, Call is performed, and finally, P is
assigned to Status.

Note that the recommended way to do this is the timed entry call ARM 9.7.2:

select
   PID.Call;  -- call to task PID
   Status := P;
or delay 10.0; -- wait to longer than 10s
   Status := Q;
end select;

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2010-04-28 18:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-28 18:16 Basic question about select John Wilkinson
2010-04-28 18:36 ` Dmitry A. Kazakov [this message]
2010-04-28 21:00   ` Jeffrey R. Carter
2010-04-28 22:41     ` Dmitry A. Kazakov
2010-04-29  0:20       ` Jeffrey R. Carter
2010-04-29  2:16         ` Adam Beneschan
2010-04-29  4:25           ` Jeffrey R. Carter
2010-04-29 17:27             ` Adam Beneschan
2010-04-29 18:42               ` Jeffrey R. Carter
2010-04-29  0:47       ` Jeffrey R. Carter
2010-04-29  7:37         ` Dmitry A. Kazakov
replies disabled

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