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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!wn13feed!worldnet.att.net!12.120.4.37!attcg2!ip.att.net!news.binc.net!kilgallen From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Date: 8 Mar 2005 14:23:23 -0600 Organization: LJK Software Message-ID: References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <1110052142.832650@athnrd02> <1110284070.410136.205090@o13g2000cwo.googlegroups.com> <395uqaF5rhu2mU1@individual.net> <112rs0bdr2aftdf@corp.supernews.com> <1inxxr988rxgg$.1w9dedak41k89.dlg@40tude.net> NNTP-Posting-Host: eisner.encompasserve.org X-Trace: grandcanyon.binc.net 1110313369 17041 192.135.80.34 (8 Mar 2005 20:22:49 GMT) X-Complaints-To: abuse@binc.net NNTP-Posting-Date: Tue, 8 Mar 2005 20:22:49 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:8881 comp.lang.c++:44652 comp.realtime:1080 comp.software-eng:4636 Date: 2005-03-08T14:23:23-06:00 List-Id: In article <1inxxr988rxgg$.1w9dedak41k89.dlg@40tude.net>, "Dmitry A. Kazakov" writes: > On Tue, 08 Mar 2005 13:33:33 -0500, CTips wrote: >> Given a processor with load-word-locked and store-word-conditional, how >> would I build an atomic increment function? > > Why should I have atomic increment function? Ada has native concurrency > support. But if somebody would need that extremely low level thing as > atomic integers, then: > > protected type Atomic_Integer is > procedure Increment; > private > Value : Integer; > end Atomic_Integer; > > -- Implementation > protected body Atomic_Integer is > procedure Increment is > begin > Value := Value + 1; > end Increment; > end Atomic_Integer; In other words, the code generator within the Ada compiler takes care of the load-locked store-conditional aspects of the architecture. What Dmitry has shown is how the programmer accesses that capability.