Passing large or complex data structures to threads

Simen Kjaeraas simen.kjaras at gmail.com
Fri May 24 07:39:03 PDT 2013


On 2013-05-24, 15:26, Joseph Rushton Wakeling wrote:

> Hello all,
>
> Are there any recommended strategies for passing large or complex data
> structures (particularly reference types) to threads?
>
> For the purpose of this discussion we can assume that it's read-only  
> data, so if
> we're talking about just an array (albeit perhaps a large one) I guess  
> just
> passing an .idup copy would be best.  However, the practical situation I  
> have is
> a data structure of the form,
>
> 	Tuple!(size_t, size_t)[][]
>
> ... which I _could_ .idup, but it's a little bit of a hassle to do so,  
> so I'm
> wondering if there are alternative ways or suggestions.

First, *is* it read-only? If so, store it as immutable and enjoy free
sharing. If not, how and why not?

-- 
Simen


More information about the Digitalmars-d-learn mailing list