comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Uninterruptible (atomic) operation?
Date: 1996/12/11
Date: 1996-12-11T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.96Dec10204319@spectre.mitre.org> (raw)
In-Reply-To: E25tK3.3G7@world.std.com


In article <E25tK3.3G7@world.std.com> bobduff@world.std.com (Robert A Duff) writes:

  > Pragma Atomic is essentially the same thing as Ada 83's pragma Shared.
  > I don't think it's what you want in this case.

  Actually this is the case where pragma Shared or pragma Atomic can
be used, if supported for the object type.  Wes just needs to lock the
value while it is being modified.  The trick is to have a lock which
all the potential modifiers respect, and to use pragma Atomic, and
Atomic reads and writes, so that the readers can trust the value they
see.

    (Potential) Writer:

       Acquire(lock);
       Temp := Atomic_Object;
       -- operations on Temp...
       Atomic_Object := Temp;
       Release(lock);

    Reader:

       Temp := Atomic_Object;
       -- use value in temp.

--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




  parent reply	other threads:[~1996-12-11  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-09  0:00 Uninterruptible (atomic) operation? W. Wesley Groleau (Wes)
1996-12-09  0:00 ` Robert A Duff
1996-12-10  0:00   ` Bob Gilbert
1996-12-11  0:00   ` Robert I. Eachus [this message]
1996-12-11  0:00     ` Robert S. White
  -- strict thread matches above, loose matches on Subject: below --
1996-12-11  0:00 W. Wesley Groleau (Wes)
1996-12-09  0:00 ` John McCabe
1996-12-13  0:00   ` Robert Dewar
1996-12-12  0:00 ` Robert Dewar
1996-12-13  0:00 ` Robert I. Eachus
1996-12-13  0:00 ` J-P. Rosen
replies disabled

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