Synchronized classes have no public members
Sean Kelly via Digitalmars-d
digitalmars-d at puremagic.com
Sat Oct 17 09:43:52 PDT 2015
On Tuesday, 13 October 2015 at 11:51:02 UTC, ponce wrote:
> On Tuesday, 13 October 2015 at 10:57:55 UTC, Marco Leise wrote:
>>
>> Yep, I prefer to think it sets of variables that need mutex
>> protection. And these are not generally the set of member
>> fields in a class.
>
> Exactly. And that makes things using synchronized prone to
> longer and more frequent locks.
Yep. Labeling methods and classes as synchronized and shared is
mostly for the sake of facilitating static analysis. But I think
it comes at the cost of good program design. Beyond facilitating
a direct port of Java code I don't know why you'd use
synchronized at the method or class level.
More information about the Digitalmars-d
mailing list