comp.lang.ada
 help / color / mirror / Atom feed
From: kaz@ashi.footprints.net (Kaz Kylheku)
Subject: Re: Ada Protected Object Tutorial #1
Date: 1999/12/16
Date: 1999-12-16T00:00:00+00:00	[thread overview]
Message-ID: <slrn85h77n.68i.kaz@ashi.FootPrints.net> (raw)
In-Reply-To: 839toq$pu$1@bgtnsc03.worldnet.att.net

On Wed, 15 Dec 1999 22:27:17 -0700, James S. Rogers
<jimmaureenrogers@worldnet.att.net> wrote:
>This is the first of hopefully several examples of uses for Ada Protected
>Objects.

[ snip ]

>Protected Procedures:
>
>Protected procedures are typically used to alter the value of one or more
>data
>components in a protected object. The parameters of a protected procedure
>may have the "IN" mode, like functions. They may also have "OUT" mode,
>indicating that the value is write only, or "IN OUT" mode indicating that
>the
>parameter value can be read and updated. Only one task at a time may
>execute a protected procedure. Protected functions cannot access the
>protected object while it is being accessed by a protected procedure.

What if a protected procedure of an object calls another
protected procedure? Presumably this is allowed, which means that some
recursive lock has to be used for the implementation, or else the compiler has
to generate code that passes around secret ``already locked'' flags into
procedures. 

How does the user of the protected object compose atomic operations?

This approach to design is generally wasteful. It's more reasonable to have
public methods which always lock and unlock, and unprotected methods which
assume that an object is already locked. It's also useful for an object
to expose lock and unlock methods, and expose unprotected operations, so that
the user of the object can compose a sequence of operations into an indivisible
block.
 
>Protected Entries:
>
>Protected entries are just like protected functions with one small
>difference.
>Protected entries block untils a boundary condition becomes true. For
>example, you would use a protected entry to read from a protected
>bounded queue. The entry would block as long as the queue was empty.

What if you want to block for something in the middle of the critical region?
I assume that you can call a protected entry from within a protected procedure.

Could you expand on what flexibilities there exist within this framework?




  reply	other threads:[~1999-12-16  0:00 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-15  0:00 Ada Protected Object Tutorial #1 James S. Rogers
1999-12-16  0:00 ` Kaz Kylheku [this message]
1999-12-16  0:00   ` John English
1999-12-16  0:00     ` Ed Falis
1999-12-16  0:00       ` Usenet Poster Boy
1999-12-17  0:00     ` Karel Th�nissen
1999-12-17  0:00       ` Mike Silva
1999-12-17  0:00       ` Laurent Guerby
1999-12-18  0:00         ` Kaz Kylheku
1999-12-18  0:00           ` Robert A Duff
1999-12-18  0:00             ` Kaz Kylheku
1999-12-18  0:00           ` Laurent Guerby
1999-12-18  0:00             ` Kaz Kylheku
1999-12-19  0:00               ` Laurent Guerby
1999-12-20  0:00                 ` Stanley R. Allen
1999-12-21  0:00               ` Robert I. Eachus
     [not found]             ` <33qr5scnbs04v391ev4541p5bv48hklg3q@4ax.com>
1999-12-20  0:00               ` Robert A Duff
1999-12-18  0:00         ` Karel Th�nissen
1999-12-18  0:00           ` Laurent Guerby
1999-12-24  0:00       ` Kenneth Almquist
1999-12-16  0:00   ` James S. Rogers
1999-12-17  0:00     ` Laurent Guerby
1999-12-17  0:00   ` Robert A Duff
1999-12-17  0:00     ` Vladimir Olensky
1999-12-17  0:00   ` Tucker Taft
1999-12-18  0:00     ` Kaz Kylheku
1999-12-18  0:00       ` Robert A Duff
1999-12-18  0:00         ` Kaz Kylheku
1999-12-19  0:00           ` swhalen
1999-12-19  0:00             ` Kaz Kylheku
1999-12-19  0:00               ` Robert Dewar
1999-12-19  0:00               ` Laurent Guerby
1999-12-20  0:00       ` Vladimir Olensky
1999-12-26  0:00         ` Ehud Lamm
1999-12-26  0:00           ` Robert Dewar
1999-12-26  0:00             ` Kaz Kylheku
1999-12-27  0:00               ` Robert Dewar
1999-12-27  0:00               ` Robert Dewar
1999-12-27  0:00                 ` Jean-Pierre Rosen
1999-12-27  0:00                 ` Richard D Riehle
1999-12-27  0:00                   ` Robert Dewar
1999-12-31  0:00                     ` Richard D Riehle
2000-01-02  0:00             ` Tucker Taft
1999-12-17  0:00 ` Robert A Duff
1999-12-18  0:00   ` Kaz Kylheku
replies disabled

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