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!newshub.sdsu.edu!logbridge.uoregon.edu!tethys.csu.net!nntp.csufresno.edu!sn-xit-03!sn-xit-08!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: CTips Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Date: Sat, 12 Mar 2005 12:36:30 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <1136a5sr4at3v3d@corp.supernews.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041217 X-Accept-Language: en-us, en MIME-Version: 1.0 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> <112s1r0rf0o8nca@corp.supernews.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@supernews.com Xref: g2news1.google.com comp.lang.ada:9241 comp.lang.c++:45306 comp.realtime:1373 comp.software-eng:4933 Date: 2005-03-12T12:36:30-05:00 List-Id: Simon Wright wrote: > Pascal Obry writes: > > >>CTips writes: >> >> >>>>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; >>>> >>> >>>Will that generate: >>> L0: >>> lwlock temp,&Value >>> add temp,temp,1 >>> stwcond temp,&Value >>> if( failed ) goto L0; >>>or will it generate something much more heavy-weight. > > > Google shows me lwlock as a C function in the PostGres support groups; > I don't know what machine architecture has these instructions? PowerPC? Yes, and alpha. > > It could be used by any compiler as part of a low-level > implementation, of course, but it's hardly likely that a C compiler > could use it off its own bat. Why whould it want to unless you the > programmer tells it to? > > If you're talking about assembler inserts in C -- for Pete's sake, we > can insert assembler in Ada as a last resort if it's needed. Can you do the following in Ada: use an assembler inset for just stwcond and lwlock, and use C for everything else, and then get the expected assembly code. > What happens with lwlock about priority inversion? You don't need it. Thats one of the big advantages about lock free schemes. > >>No protected type implementations will be so light. Umm ... look at the set of lock-free data-structures out there. Quite heavy-weight structures can be implemented, including a queue where a thread can be adding elements while other threads are removing elements.