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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,26f34062c627f3d4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-27 09:21:12 PST From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: Concurrent access to packed arrays Date: 27 Jan 2001 17:37:29 +0100 Organization: Enyo's not your organization Message-ID: <873de5dk8m.fsf@deneb.enyo.de> References: <87g0id8939.fsf@deneb.enyo.de> <3A71447B.A2082CA3@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Path: supernews.google.com!sn-xit-02!supernews.com!isdnet!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!blackbush.xlink.net!rz.uni-karlsruhe.de!news.uni-ulm.de!news.belwue.de!LF.net!news.enyo.de!news1.enyo.de!not-for-mail Xref: supernews.google.com comp.lang.ada:4607 Date: 2001-01-27T17:37:29+01:00 List-Id: Mats Weber writes: > Yes, I think there are. When task B writes the data, it will do > something like > > The_String(Last_Written + 1) := ... > Last_Written := Last_Written + 1; > > on modern architectures, the memory accesses can get reordered, i.e. > Last_Written can get updated before The_String and reading tasks will > read uninitialized data. Very good point. Thanks. (Not every architecture has complex cache coherency protocols like Intel's. ;-) So I'm going to add an interface which uses a protected type. (There's no need to use it by default because most of the time, no concurrent access occurs.)