Passing associative array to another thread
Jacob Carlborg
doob at me.com
Sat Sep 22 03:30:30 PDT 2012
On 2012-09-22 11:24, Martin Drasar wrote:
> thanks for the hint. Making it shared sounds a bit fishy to me. My
> intention is to pass some read only data, that are in fact thread local
> and there is no real need to make them shared.
The whole point of thread local data is that it's only accessible from a
single thread. If you want to share it with another thread you have, as
far as I know, there options:
1. Declare it as "shared"
2. Declare it as "immutable"
3. Make a copy, i.e. serialize the data
> The (de)serialization is possible but the overhead seems a bit
> pointless. I will alter the code to use something else than AAs if there
> is no other way.
>
> The data I am trying to pass is in fact just name-value pairs. I have
> tried to use Tuples, but I have hit another batch of problems. One was
> related to issue #5783, but another made me really scratch my head...
Looking at your original example I don't understand why the immutable aa
won't work. That's the whole point of immutable, it's safe to share
among threads. It's probably a bug somewhere. I think someone else can
answer these questions better than me.
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list