comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@avercom.net>
Subject: Re: Question on using protected objects
Date: Sat, 29 Sep 2001 13:29:10 -0400
Date: 2001-09-29T17:26:31+00:00	[thread overview]
Message-ID: <3BB604E6.684884D9@avercom.net> (raw)
In-Reply-To: Rtbt7.51417$QK.34810279@news1.sttln1.wa.home.com



DuckE wrote:

> Without getting into the details of what I'm leading up to, is the line
> marked in the text
> code snippet below a valid thing to do?

Yes.

Is there a reason you thought it might be illegal?

It compiles cleanly in my favorite compiler.

I presume you might be wondering whether you can
use the entry family index in an entry barrier.  The
answer is definitely.  An entry family is like an array
of entries, and each has its own entry queue, and may
hence have an entry barrier expression that differs
according to the entry family index.

Normal entries are not allowed to reference their "normal"
parameters in the entry barrier expression because there is
only one entry queue, and the entry barrier applies to the
queue as a whole, not individual calls on the entry.
The parameters of course depend on individual calls.

-Tucker Taft  stt@avercom.net


>
>
>   SUBTYPE aWaitSelect IS INTEGER RANGE 1 .. 3;
>   TYPE aWaitArray IS ARRAY( aWaitSelect ) OF BOOLEAN;
>
>   PROTECTED TYPE aQueueingType IS
>     ENTRY GetEntry( waitSelect  : aWaitSelect; getResult : out Integer );
>     PROCEDURE Release( waitSelect  : aWaitSelect );
>   PRIVATE
>     ENTRY WaitForIt( aWaitSelect );
>     waitFlag : aWaitArray := ( OTHERS => FALSE );
>     counter  : Natural := 0;
>   END aQueueingType;
>
>   PROTECTED BODY aQueueingType IS
>     PROCEDURE Release( waitSelect : aWaitSelect ) IS
>     BEGIN
>       waitFlag( waitSelect  ) := TRUE;
>     END Release;
>     ENTRY GetEntry( waitSelect : aWaitSelect;
>                      getResult : out Integer ) WHEN GetEntry'COUNT = 0 IS
>     BEGIN
>       getResult := counter;
>       counter := counter + 1;
>       REQUEUE WaitForIt( waitSelect );
>     END GetEntry;
>     ENTRY WaitForIt ( FOR waitSelect IN aWaitSelect )
>          WHEN waitFlag( waitSelect ) IS  -- <<<<<<<<<<<< is it OK to use
> waitSelect here???
>     BEGIN
>       waitFlag( waitSelect ) := FALSE;
>     END WaitForIt;
>   END aQueueingType;
>
> Thanks in advance,
> SteveD




  parent reply	other threads:[~2001-09-29 17:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-29  3:45 Question on using protected objects DuckE
2001-09-29  6:16 ` Jeffrey Carter
2001-09-29 12:30   ` DuckE
2001-09-29 14:20     ` Jeff Creem
2001-09-29 15:09       ` DuckE
2001-09-29 17:24     ` Ehud Lamm
2001-09-29 17:29 ` Tucker Taft [this message]
2001-09-29 19:01   ` DuckE
replies disabled

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