synchronized - shared but actually useful
FeepingCreature
feepingcreature at gmail.com
Wed Oct 31 09:43:45 UTC 2018
Update to previous post:
synchronized class Class {
void foo() @safe { }
}
void main() { auto object = new Class; object.foo(); }
This errors because object is not shared. Why is that a problem?
It's not shared, but it is synchronized; there is no possibility
of a threading issue here.
Analogously, I cannot do
synchronized class Class {
private Class object;
Class foo() @safe { return this.object; }
}
either, despite the fact that Class is again synchronized and
thus should be able to be treated as shared implicitly.
More information about the Digitalmars-d
mailing list