Synchronized Classes and Struct Members
Andrew Wiley
wiley.andrew.j at gmail.com
Mon Oct 24 23:06:49 PDT 2011
Geez, I try to write some multithreaded code and I just keep hitting these:
--------
module test3;
struct SomeData {
int i;
int iPlus2() {
return i + 2;
}
}
synchronized class Bob {
private:
SomeData _dat;
public:
this() {
_dat.i = 3;
}
@property
int i() {
return _dat.iPlus2(); // test3.d(22): Error: function test3.SomeData.iPlus2
() is not callable using argument types () shared
}
}
--------
This seems like it should be legal because SomeData is a value type.
Accessing _dat.i directly is legal, and _dat can't possibly be shared. If
I'm understanding things correctly, transitive shared shouldn't apply to
value types like this, so the type of "this" when calling iPlus2 should just
be SomeData.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20111025/841316ab/attachment.html>
More information about the Digitalmars-d
mailing list