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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Safety of unprotected concurrent operations on constant objects Date: Sat, 03 May 2014 22:40:31 +0100 Organization: A noiseless patient Spider Message-ID: References: <7403d130-8b42-43cd-a0f1-53ba34b46141@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="6c8e46900abaabd1a3b7c03d9ac850ff"; logging-data="8820"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19vqeYuqQfiSwxbzdKY7NDUTvAQPBehtII=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:Pz02NHiqdQOp2Zxj77oifHny/3w= sha1:bwRIMqXzRcA0Cu1ekd0ch8lLLxw= Xref: news.eternal-september.org comp.lang.ada:19651 Date: 2014-05-03T22:40:31+01:00 List-Id: Natasha Kerensikova writes: > So if I happened to need concurrent read operations (e.g. because > sequencing them through a protected procedure is too inefficient), I > can't use the standard containers. Is that right? That would certainly be true for some of the Booch Components' Unbounded forms, which cache the last-referenced element for a performance improvement if it's re-referenced (I have no idea what evidence Grady Booch had that that would actually help anyone!). And the way that implementations of Ada.Containers protect against tampering might cause problems; the GCC 4.9.0 Vectors has type Vector is new Controlled with record Elements : Elements_Access; Last : Extended_Index := No_Index; Busy : Natural := 0; Lock : Natural := 0; end record; and Busy and Lock aren't task-safe. Of course those considerations have nothing to do with whether your supposedly constant elements are in fact so.