std.concurrency bug?
Charles Hixson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed May 21 20:46:43 PDT 2014
On Wednesday, May 21, 2014 01:19:32 PM Ali Çehreli via Digitalmars-d-learn
wrote:
> On 05/20/2014 05:24 PM, Charles Hixson via Digitalmars-d-learn wrote:
> > On Tuesday, May 20, 2014 11:42:48 AM Ali Çehreli via Digitalmars-d-learn
> >
> > wrote:
> >> On 05/20/2014 11:38 AM, Charles Hixson via Digitalmars-d-learn wrote:
> >>> Is it a bug that an immutable struct cannot be sent to a thread? (It
> >>> compiles without problem if I make all elements mutable.)
>
> Further reduced:
>
> import std.concurrency;
>
> struct S
> {
> immutable int i;
> }
>
> void foo()
> {}
>
> void main()
> {
> auto f = spawn(&foo);
>
> auto s = S();
> f.send(s);
> }
>
> I think this is a known issue with immutable and Variant, which
> std.concurrency uses for unknown messages. This looks related:
>
> https://issues.dlang.org/show_bug.cgi?id=5538
>
> Ali
Thanks. Fortunately, I don't really need for messages to be immutable, I just
thought it would be safer (as in avoiding the possibility of making a
mistake). They're stucts, and I never pass a pointer, just the struct. Being
immutable would allow me to guarantee that certain logic errors couldn't be
committed is all.
More information about the Digitalmars-d-learn
mailing list