March 30, 2012 structs, tids, and concurrency. | ||||
|---|---|---|---|---|
| ||||
Nesting a Tid in a struct is interpreted as having local aliasing, though a bare Tid is not.
This doesn't work, though commenting out "receiveOnly!S()" and "tid.send(S(thisTid))" works:
-----
import std.stdio;
import std.concurrency;
void main() {
auto thread = spawn(function void(Tid tid)
{
tid.send(thisTid);
tid.send(S(thisTid));
}, thisTid);
receiveOnly!Tid();
receiveOnly!S();
}
struct S {
Tid tid;
}
-----
$ rdmd test.d
/usr/share/dmd/src/phobos/std/concurrency.d(319): Error: static assert "Aliases to mutable thread-local data not allowed."
../test.d(9): instantiated from here: send!(S)
Failed: dmd -v -o- '../test.d' -I'..' >../test.d.deps
| ||||
March 30, 2012 Re: structs, tids, and concurrency. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nathan M. Swan | On 03/30/2012 10:18 AM, Nathan M. Swan wrote: > Nesting a Tid in a struct is interpreted as having local aliasing, > though a bare Tid is not. > http://d.puremagic.com/issues/show_bug.cgi?id=4957 | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply