comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <OneWingedShark@gmail.com>
Subject: Re: Example question
Date: Sun, 26 Oct 2014 08:21:11 -0600
Date: 2014-10-26T08:21:11-06:00	[thread overview]
Message-ID: <Ar73w.335365$Hb3.325531@fx03.iad> (raw)
In-Reply-To: <0fbd755d-7bcf-42b1-a20b-c6a2c74c7d6e@googlegroups.com>

On 26-Oct-14 07:27, compguy45@gmail.com wrote:
> body Spreadsheet_Task is
>      begin
>          loop
>              select
>                  accept Recalculate;
>                  Do_Recalculation;
>              or
>                  accept Shutdown;
>                  exit;
>              end select;
>          end loop;
>      end Spreadsheet_Task;
>
> Tutorial says "If calls to both entries are already pending,
> one will be accepted non-deterministically." what does that
> mean? If calls are pending on bith entries it might happend
> that Shutdown is accepted and exits in which case thats not
> good solution at all
>

It means that if it enters the SELECT and there are already tasks 
waiting at the rendezvous for both entry-points then one will be chosen 
"at random". (Though I heard that some compilers /did/ have a 
deterministic behavior here.)

Perhaps you would need to add a guard to the Shutdown entry, something 
like the following: When Recalculate'Count = 0.
(I haven't really used tasking w/ guards, but I /think/ that'll work.)

  parent reply	other threads:[~2014-10-26 14:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-26 13:27 Example question compguy45
2014-10-26 14:18 ` Martyn Pike
2014-10-26 15:46   ` J-P. Rosen
2014-10-26 16:53     ` Martyn Pike
2014-10-26 14:21 ` Shark8 [this message]
2014-10-26 15:42   ` Simon Wright
2014-10-26 15:48   ` Robert A Duff
2014-10-26 14:33 ` Niklas Holsti
replies disabled

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