Concurrency Confusion

Dicebot via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 4 04:42:53 PDT 2015


On Tuesday, 4 August 2015 at 11:33:11 UTC, 岩倉 澪 wrote:
> On Tuesday, 4 August 2015 at 10:37:39 UTC, Dicebot wrote:
>> std.concurrency does by-value message passing (in this case 
>> just ptr+length), it never deep copies automatically
>
> I assumed that it would deep copy (in the case of mutable data) 
> since the data being sent is thread-local (unless I am 
> misunderstanding something)

It is heap-allocated and in there is no thread-local heap 
currently in D - only globals and static variables.

std.concurrency never deep copies - if you are trying to send 
data which contains indirections (pointers/arrays) _and_ is not 
marked either immutable or shared, it will simply not compile.


More information about the Digitalmars-d-learn mailing list