Sending Tid in a struct

Nicolas Silva nical.silva at gmail.com
Sat Mar 3 03:09:25 PST 2012


Hi,

I'm trying to send structs using std.concurrency. the struct contains
a Tid (the id of the sender) so that the receiver can send an answer.

say:

struct Foo
{
  Tid tid;
  string str;
}

// ...

Foo f = {
  tid: thisTid,
  str: "hello!"
};
std.concurrency.send(someThread, f);
// /usr/include/d/dmd/phobos/std/concurrency.d(465): Error: static
assert  "Aliases to mutable thread-local data not allowed."
// hello.d(15):        instantiated from here: send!(Foo)

However, I can send a Tid if I pass it directly as a parameter of the
send function instead of passing it within a struct.

Is this a bug ? It looks like so to me but I guess I could have missed
something.

thanks in advance,

Nicolas


More information about the Digitalmars-d-learn mailing list