comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Ada Protected Object Tutorial #1
Date: 1999/12/18
Date: 1999-12-18T00:00:00+00:00	[thread overview]
Message-ID: <wccaen8t26c.fsf@world.std.com> (raw)
In-Reply-To: slrn85npi1.4ps.kaz@ashi.FootPrints.net

kaz@ashi.footprints.net (Kaz Kylheku) writes:

> This requires the procedures to be passed information about whether the
> object is locked by this thread or not. For example, a hidden parameterr.

No, the Ada rules require a compile-time determination of whether a
given call is an "internal" call (no locking; assumed already locked),
or an "external" call.  There is no run-time overhead.

> These solution requires some measure of clairvoyance: what if the protected
> procedure calls into another subsystem which then calls back into a protected
> procedure on the same object? How do you pass the ``already_locked'' knowledge
> across calls to foreign subsystems?

That situation is, by definition, an "external" call.  It will attempt
to lock the protected object, and since it's the same object, it will
deadlock.  It's only in well-defined (compile-time-known) cases that are
defined as "internal" calls.

By the way, I'm not sure exactly what you mean by "clairvoyance" in this
case.

> The solution is probably to use recursive locks, which check the ID of the
> calling against an ownership ID stored in the lock. Recursive locks are
> slightly inefficient because they have to retrieve the ID of the current thread
> and compare it.

If you want recursive locks in Ada, you have to program them yourself --
the run-time system doesn't do that automatically.

- Bob




  parent reply	other threads:[~1999-12-18  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
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           ` 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           ` Robert A Duff [this message]
1999-12-18  0:00             ` Kaz Kylheku
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                 ` 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
1999-12-27  0:00               ` Robert Dewar
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