From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: About task-safeness
Date: Thu, 03 Feb 2011 09:53:03 +0100
Date: 2011-02-03T09:53:03+01:00 [thread overview]
Message-ID: <8qv8neF9i0U1@mid.individual.net> (raw)
In-Reply-To: <iid4qm$mk2$1@munin.nbi.dk>
Randy Brukardt wrote:
> "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.
Randy, could you be more explicit about your suggested use of Atomic? As
I understand it, even if a counter variable N is Atomic, two tasks
concurrently executing an assignment of the form
N := N + 1;
can interleave their actions so that N is increased by only 1, not by 2
as intended.
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
next prev parent reply other threads:[~2011-02-03 8:53 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
2011-02-03 8:53 ` Niklas Holsti [this message]
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