From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: About task-safeness
Date: Wed, 2 Feb 2011 20:44:34 -0600
Date: 2011-02-02T20:44:34-06:00 [thread overview]
Message-ID: <iid4qm$mk2$1@munin.nbi.dk> (raw)
In-Reply-To: 06ecb5ab-a9e5-4a5d-9370-6bbe137d3693@glegroupsg2000goo.googlegroups.com
"mockturtle" <framefritti@gmail.com> 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.
next prev parent reply other threads:[~2011-02-03 2:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-02 20:51 About task-safeness mockturtle
2011-02-02 21:01 ` Vinzent Hoefler
2011-02-02 21:14 ` mockturtle
2011-02-02 22:16 ` Maciej Sobczak
2011-02-02 22:28 ` Shark8
2011-02-02 22:40 ` Peter C. Chapin
2011-02-03 8:33 ` Dmitry A. Kazakov
2011-02-03 17:59 ` Vinzent Hoefler
2011-02-02 22:38 ` J-P. Rosen
2011-02-03 2:44 ` Randy Brukardt [this message]
2011-02-03 8:53 ` Niklas Holsti
2011-02-03 11:07 ` Georg Bauhaus
2011-02-03 11:22 ` AdaMagica
2011-02-03 18:13 ` Jeffrey Carter
2011-02-04 0:33 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox