[Issue 13262] Cannot send certain shared data to another thread

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Aug 6 10:32:25 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13262

--- Comment #1 from Andrei Alexandrescu <andrei at erdani.com> ---
The plot thickens - some types are oddly rejected. In the example below, adding
an int to a struct "fixes" it!

import std.concurrency;

struct S1
{
    int c;
    string a;
}

struct S2
{
    string a;
    shared int[] b;
}

struct S3
{
    string a;
    shared int[] b;
    int c;
}

void fun(T)() {
    T object;
    thisTid.send(object);
}

void main(string[] args) {
    fun!int();
    fun!(shared int);
    fun!S1;
    fun!(shared S1);
    fun!S2;
    fun!(shared S2);
    fun!S3;
    fun!(shared S3);
}

--


More information about the Digitalmars-d-bugs mailing list