On Saturday, 8 August 2015 at 00:39:57 UTC, 岩倉 澪 wrote:
Found the answer to this :)
http://forum.dlang.org/post/mailman.1706.1340318206.24740.digitalmars-d-le...@puremagic.com
I send the results from my worker thread with assumeUnique, and
then simply cast away immutable in the receiving thread like so:
(in module scope)
Bar[] baz;
(in application loop)
import std.array
if(baz.empty)
{
import std.concurrency, std.datetime;
receiveTimeout(0.msecs,
(immutable Bar[] bar){ baz = cast(Bar[])bar; });
}
I'm not completely sure that it's bad in this case, but you
really shouldn't be casting away immutable. It's undefined
behaviour in D.