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,e81fd3a32a1cacd2 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!130.59.10.21.MISMATCH!kanaga.switch.ch!switch.ch!newsserver.news.garr.it!newsserver.cilea.it!not-for-mail From: Colin Paul Gloster Newsgroups: comp.lang.ada Subject: Re: Does Ada tasking profit from multi-core cpus? Date: 7 Mar 2007 10:11:25 GMT Organization: CILEA Message-ID: References: NNTP-Posting-Host: docenti.ing.unipi.it X-Trace: newsserver.cilea.it 1173262285 19448 131.114.28.20 (7 Mar 2007 10:11:25 GMT) X-Complaints-To: news@cilea.it NNTP-Posting-Date: 7 Mar 2007 10:11:25 GMT Xref: g2news2.google.com comp.lang.ada:9743 Date: 2007-03-07T10:11:25+00:00 List-Id: Tom Moran posted on Mon, 05 Mar 2007 23:33:31 -0600: "[..] global_flag : integer := 0; protected body pt is function f(id : integer) return natural is change_count : natural := 0; begin global_flag := id; for i in 1 .. 10_000_000 loop if global_flag /= id then change_count := change_count; global_flag := id; end if; end loop; return change_count; end f; end pt; One task calls pt.f(id=>1) and the other calls pt.f(id=>2). They both get a result of zero back from their function call. This was with Gnat 3.15p Windows 2000 on a dual core Pentium. If I change it from a single protected object to two instances of a protected type, then the function calls are overlapped and return non-zero results. [..]" Tom Moran posted on Tue, 06 Mar 2007 12:58:34 -0600: "[..] Sorry. That's a typo in trying to pretty-up the code for posting. The actual code that ran was: if pt_flag /= id then result := result+1; pt_flag := id; end if; which, as you see, does indeed do an increment. Which is why > > If I change it from a single > > protected object to two instances of a protected type, then the function > > calls are overlapped and return non-zero results. [..]" Was the return statement return change_count; or some other item whose value was never changed according to the semantics of Ada as in your original post in which case the behavior is still not valid Ada, or did the return statement return something like result or pt_flag? Regards, Colin Paul Gloster