Bug 5538 – Immutable classes can't be passed as messages in std.concurrency

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-02-07T11:37:00Z
Last change time
2016-08-05T13:17:17Z
Assigned to
nobody
Creator
tomeksowi
See also
https://issues.dlang.org/show_bug.cgi?id=6585

Comments

Comment #0 by tomeksowi — 2011-02-07T11:37:04Z
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 #1 by dsimcha — 2011-04-12T17:41:07Z
https://github.com/D-Programming-Language/phobos/commit/325a8fe64a15c57dcde3f8326ad35cfd638f86c7 Fixed the Rebindable part. Hopefully the Variant part will be fixed with Rob Jacques's upcoming Variant update.
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!