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: 115aec,c729078cdd5cb9,start X-Google-Attributes: gid115aec,public X-Google-Thread: 103376,2ef9ab4638027d85 X-Google-Attributes: gid103376,public From: WhiteR@CRPL.Cedar-Rapids.lib.IA.US (Robert S. White) Subject: Re: Uninterruptible (atomic) operation? Date: 1996/12/11 Message-ID: <58lb74$e6e@flood.weeg.uiowa.edu>#1/1 X-Deja-AN: 203436068 references: <9612091326.AA04263@most> content-type: Text/Plain; charset=US-ASCII organization: my ISP is the Cedar Rapids Public Library mime-version: 1.0 newsgroups: comp.lang.ada,comp.realtime Date: 1996-12-11T00:00:00+00:00 List-Id: In article , eachus@spectre.mitre.org ...snip... using Ada95 > 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. OK. I can live with that. In the past using Ada83 and a local (company generated - DO-178BB) Real Time Executive (RTE) I could do the following (assuming a record structure): (Potential) Writer: with ESR; ... ESR.Enter_Critical_Section; -- various updating operations on Object. ESR.Leave_Critical_Section; Reader: with ESR; ... ESR.Enter_Critical_Section; Temp := Object.all; ESR.Leave_Critical_Section; -- use value in temp. With the real time constraint that thou use'st a minimum (1/3 of a tick max) time within a critical section. ESR = Executive Service Routine package. But what Robert Eachus suggests is semantically equivalent and inclusive in a new ISO standardized language rather than a older language and a unique RTE. _______________________________________________________________________ Robert S. White -- an embedded sys software engineer WhiteR@CRPL.Cedar-Rapids.lib.IA.US --long/cheap alternate I-net address