xxxxxxxxxx
import std.concurrency;
import std.stdio;
shared class SuperUsefulThing
{
private int _value;
this() { _value = 0; }
int read() { return _value; }
void write(int value) { _value = value; }
}
void main()
{
auto mySharedObject = new shared SuperUsefulThing();
mySharedObject.write(7);
static void otherThread(shared SuperUsefulThing t)
{
t.read();
t.write(1234);
}
spawn(&otherThread, mySharedObject);
writeln(mySharedObject.read());
}