Test case:
class C {}
thisTid.send(new immutable(C)());
receive((immutable C) { writeln("got it!"); });
This throws: core.exception.AssertError@/usr/include/d/dmd/phobos/std/variant.d(285): immutable(C)
And when I replace immutable(C) with Rebindable, I get "Aliases to mutable thread-local data not allowed.".
Comment #2 by shammah.chancellor — 2013-11-25T04:17:37Z
Ping. This is a really important issue for multithreaded D. Seems like after 2 years this should be able to be patched.
Comment #3 by opantm2+dbugs — 2014-05-29T01:15:17Z
Looks like this works on DMD head.
Updated sample (added name for parameter to allow compiling and wrapped in main):
import std.variant, std.concurrency;
class C {}
void main() {
thisTid.send(new immutable(C)());
receive((immutable C c) { writeln("got it!"); });
}
DMD 2.065.0:
rdmd test.d
core.exception.AssertError@/opt/dmd/phobos/std/variant.d(288): immutable(C)
DMD Git Head:
rdmd test.d
got it!