Re: Passing associative array to another thread

2012-09-25 Thread Jacob Carlborg
On 2012-09-25 00:47, Sean Kelly wrote: If you're passing via std.concurrency then you'll currently have to cast to shared. I'd been considering allowing Unique!T to be sent as well, but haven't done so yet. Hey, if it's immutable why use std.concurrency at all? Just import the module and

Re: Passing associative array to another thread

2012-09-25 Thread Jacob Carlborg
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:

Re: Passing associative array to another thread

2012-09-25 Thread Martin DraĊĦar
Dne 25.9.2012 18:19, Jacob Carlborg napsal(a): 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. It is not some single piece of data. I have a queue of

Re: Passing associative array to another thread

2012-09-24 Thread Sean Kelly
On Sep 22, 2012, at 2:24 AM, Martin Drasar dra...@ics.muni.cz wrote: On 21.9.2012 19:01, Jacob Carlborg wrote: Perhaps declaring the associative array as shared. An alternative would be to serialize the aa, pass it to another thread, and deserialize it. That would though create a copy. Hi

Re: Passing associative array to another thread

2012-09-23 Thread Jacob Carlborg
On 2012-09-22 13:50, Johannes Pfau wrote: 1. Declare it as shared There's also __gshared. Yeah, forgot about that one. -- /Jacob Carlborg

Re: Passing associative array to another thread

2012-09-22 Thread Martin Drasar
On 21.9.2012 19:01, Jacob Carlborg wrote: Perhaps declaring the associative array as shared. An alternative would be to serialize the aa, pass it to another thread, and deserialize it. That would though create a copy. Hi Jacob, thanks for the hint. Making it shared sounds a bit fishy to me.

Re: Passing associative array to another thread

2012-09-22 Thread Jacob Carlborg
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

Re: Passing associative array to another thread

2012-09-22 Thread Jonathan M Davis
On Saturday, September 22, 2012 12:30:30 Jacob Carlborg wrote: 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

Re: Passing associative array to another thread

2012-09-22 Thread Martin Drasar
On 22.9.2012 13:19, Jonathan M Davis wrote: The problem with immutable is probably due to this bug: http://d.puremagic.com/issues/show_bug.cgi?id=5538 And casting to shared probably won't work due to this bug: http://d.puremagic.com/issues/show_bug.cgi?id=6585 std.variant needs quite

Re: Passing associative array to another thread

2012-09-22 Thread Johannes Pfau
Am Sat, 22 Sep 2012 12:30:30 +0200 schrieb Jacob Carlborg d...@me.com: 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

Re: Passing associative array to another thread

2012-09-22 Thread Martin Drasar
On 22.9.2012 13:50, Johannes Pfau wrote: 1. Declare it as shared There's also __gshared. Yup, that works. Thanks

Passing associative array to another thread

2012-09-21 Thread Martin Drasar
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;

Re: Passing associative array to another thread

2012-09-21 Thread Jacob Carlborg
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: