From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2ef9ab4638027d85 X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Uninterruptible (atomic) operation? Date: 1996/12/11 Message-ID: #1/1 X-Deja-AN: 203425796 references: <9612091326.AA04263@most> organization: The Mitre Corp., Bedford, MA. newsgroups: comp.lang.ada Date: 1996-12-11T00:00:00+00:00 List-Id: In article 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...