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: a07f3367d7,4fe1e6b66c35dfe2 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,CP1252 Path: g2news2.google.com!postnews.google.com!8g2000prb.googlegroups.com!not-for-mail From: AdaMagica Newsgroups: comp.lang.ada Subject: Re: About task-safeness Date: Thu, 3 Feb 2011 03:22:53 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <06ecb5ab-a9e5-4a5d-9370-6bbe137d3693@glegroupsg2000goo.googlegroups.com> <8qv8neF9i0U1@mid.individual.net> <4d4a8c88$0$6773$9b4e6d93@newsspool3.arcor-online.net> NNTP-Posting-Host: 80.156.44.178 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1296732173 22604 127.0.0.1 (3 Feb 2011 11:22:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 3 Feb 2011 11:22:53 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 8g2000prb.googlegroups.com; posting-host=80.156.44.178; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.2; de; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:17816 Date: 2011-02-03T03:22:53-08:00 List-Id: On 3 Feb., 12:07, Georg Bauhaus wrote: > > Randy, could you be more explicit about your suggested use of Atomic? A= s I > > understand it, even if a counter variable N is Atomic, two tasks concur= rently > > executing an assignment of the form > > > =A0 =A0N :=3D N + 1; > > > can interleave their actions so that N is increased by only 1, not by 2= as > > intended. > > When I first read about atomic counting, I thought so, too. =A0But then, > I noticed a new(?) Implementation Advice in the LRM that says, IIRC, > that compilers should make atomic processor ops available, including > decrement. =A0A neighboring paragraph is about intrinsic operations. You mean C.1(11-12): (11) It is recommended that intrinsic subprograms be provided for convenient access to any machine operations that provide special capabilities or efficiency and that are not otherwise available through the language constructs. Examples of such instructions include: (12) =95 Atomic read-modify-write operations =97 e.g., test and set, compare and swap, decrement and test, enqueue/dequeue. But N :=3D N + 1; is not such an operation even if N is atomic. An implementation would have to provide something like a CAS operation.