comp.lang.ada
 help / color / mirror / Atom feed
From: Jim Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: tasks, protected types and entries
Date: Sun, 17 Mar 2002 15:46:42 GMT
Date: 2002-03-17T15:46:42+00:00	[thread overview]
Message-ID: <3C94BA62.3050102@worldnet.att.net> (raw)
In-Reply-To: 562l8.9685$%_6.1720374@news11-gui.server.ntli.net

To quote from "Ada as a Second Language" page 860:

"A guard is a construct of the form
    when condition =>
that may precede some or all the alternatives of a selective accept.
A guard has the same form as a barrier in a protected-type entry
body (..) and plays a similar role."

In short, yes, an entry barrier on a protected object does limit
access to the protected object. A guard on a task's selective
accept provides conditions for completion of a rendezvous.

Jim Rogers

chris.danx wrote:

> "chris.danx" <chris.danx@ntlworld.com> wrote in message
> news:%12l8.9656$%_6.1717935@news11-gui.server.ntli.net...
> 
>>Hi,
>>
>>What is the difference between an entry and a procedure?  I think the
>>difference is that a procedure will always execute regardless of any
>>condition, but that an entry can have a guard to allow/prevent its
>>
> execution
> 
>>if a given condition is satisfied.
>>
>>So for a (protected) queue, the procedure Enqueue (someitem) would run in
>>any circumstance and the entry Dequeue (an_item: out sometype) would run
>>only when it is sensible to do so.  i.e. when there are items in the
>>
> Queue.
> 
> That's ambiguous.  I meant to say,
> 
> "the procedure Enqueue (someitem) would run when called, but the entry
> Dequeue (an_item : out sometype) would run when called, but only when it
> made sense to do so. i.e. when there are items in the Queue."
> 
> Another thought:  Calls to entries can time out, right?  Does that mean
> after a certain time of the Queue being empty the calling task will abandon
> the call to Dequeue, possibly doing something else?
> 
> 
> Chris
> 
> 
> 




  reply	other threads:[~2002-03-17 15:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-17 14:50 tasks, protected types and entries chris.danx
2002-03-17 14:55 ` chris.danx
2002-03-17 15:46   ` Jim Rogers [this message]
2002-03-17 16:49     ` Sergey Koshcheyev
2002-03-17 19:46       ` Robert A Duff
2002-03-17 19:44 ` Richard Riehle
2002-03-17 20:06   ` Ehud Lamm
2002-03-17 21:53   ` Pat Rogers
2002-03-18  1:42     ` Jeffrey Carter
2002-03-18  5:14       ` Pat Rogers
2002-03-18  0:36   ` Bo Sanden
2002-03-29  0:10   ` chris.danx
2002-03-18 16:41 ` john mann
replies disabled

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