Synchronized classes have no public members
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Fri Oct 16 00:22:06 PDT 2015
On Friday, 16 October 2015 at 07:02:54 UTC, Jacob Carlborg wrote:
> On 2015-10-16 08:49, Dicebot wrote:
>
>> As far as I understand topic is about deprecating direct field
>> access of
>> synchronized classes, method calls in synhronized classes and
>> `synchronized () {}` blocks will remain untouched.
>
> Is it even possible to do synchronized classes in Java? That
> is, but synchronized on the class declaration as in D.
I don't think so. synchronized is definitely for functions in
Java and C# (and at the moment, D). synchronized classes like
TDPL describes don't necessarily conflict with that, but they do
force all of the functions in a class to be synchronized, whereas
in Java or C#, only a portion of the class may care about or need
synchronization. synchronized classes are certainly safer though,
since they make it so that you can't get around the mutex without
casting.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list