Nice to @Share?

Neal Gafter neal at gafter.com
Mon Feb 22 13:54:41 PST 2010


On Mon, Feb 22, 2010 at 1:52 PM, Joshua Bloch <jjb at google.com> wrote:
>> Re 'In practical terms, it means "this variable must *not* be shared
>> (without additional synchronization)."', this doesn't really make much
>> sense to me; all variables (whether marked @Shared or not) must not be
>> shared between threads (without additional synchronization).
>
> Not so. Shared mutable state must be synchronized.  If it's not shared or
> not mutable, no synchronization is necessary.

Variables that are marked @Shared (or whatever) are not necessarily
mutated (or shared between threads); synchronization is orthogonal.


More information about the lambda-dev mailing list