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,4fe1e6b66c35dfe2 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: About task-safeness Date: Wed, 2 Feb 2011 20:44:34 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <06ecb5ab-a9e5-4a5d-9370-6bbe137d3693@glegroupsg2000goo.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1296701078 23170 69.95.181.76 (3 Feb 2011 02:44:38 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 3 Feb 2011 02:44:38 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Xref: g2news2.google.com comp.lang.ada:17803 Date: 2011-02-02T20:44:34-06:00 List-Id: "mockturtle" wrote in message news:06ecb5ab-a9e5-4a5d-9370-6bbe137d3693@glegroupsg2000goo.googlegroups.com... ... >(For example, a package defining some type of object could keep the number >of allocated >objects, so it can give to each object a unique ID.) If such a package was >used by two >different tasks, and the counter was not protected, obscure bugs can arise. >This type of >structure maybe is not very recommended, but it happens... :-( Note that "protection" may simply be declaring the object Atomic. Presuming the compiler supports that, there isn't a problem with multiple tasks accessing the same counter. (The main problem with small objects is compilers that get too helpful and optimize the unoptimizable.) ... >Consider, for example, the Ordered_Maps package. That package is not Pure >(it cannot be, >since it would prevent the use of named access types), so how can I be >granted that the package >does not have some "hidden" and unprotected state? Hidden and truely unprotected would violate the RM, as noted by others. But hidden and Atomic is fine (the Janus/Ada containers will use counters this way to detect dangling cursors). Randy.