Passing associative array to another thread

Jacob Carlborg doob at me.com
Tue Sep 25 09:19:07 PDT 2012


On 2012-09-21 16:33, Martin Drasar wrote:
> Hi,
>
> I am using the std.concurrency module and I would like to send an
> associative array to another thread.
>
> If I try this:
>
> string[string] aa;
> someThread.send(aa);
>
> I get: Aliases to mutable thread-local data not allowed.
>
> And if I try to use this:
>
> immutable(string[string]) aa;
> someThread.send(aa);
>
> I get:
> /usr/include/d/dmd/phobos/std/variant.d(539): Error: *p is not mutable

BTW, why do you need to use std.currency at all if it's immutable, just 
share it as a global. The whole point of immutable is that it can be 
freely shared among threads without any risks.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list