Nice to @Share?

Neal Gafter neal at gafter.com
Tue Feb 23 15:35:12 PST 2010


On Tue, Feb 23, 2010 at 12:57 PM, Doug Lea <dl at cs.oswego.edu> wrote:
> On 02/23/10 15:46, Neal Gafter wrote:
>
>>  Fields that are not used in lambdas or inner
>> classes are verifiably and provably not shared between threads.
>
> Could you suggest a term and definition of these things so
> it can be used in your requested clarification of JLS sec 17.4?

Yes: I'd just call them "variables" (17.4.1), and include static
fields, instance fields, array elements, local variables, formal
parameters, and exception handler parameters under that term.  The
term "heap memory" can be removed, as it serves no purpose in the
spec.  The term "shared memory" should be defined as "memory that is
shared between threads".

>> Final variables have guarantees in the memory model too.
>
> Weaker and messier ones.

Weaker and messier than what?  The language spec does not currently
have any other guarantees for final local variables that are shared
between threads; if these rules do not apply, then what does?  As far
as I can tell, for the limited ways in which final local variables can
be used, the guarantees are just as strong as you could hope for.


More information about the lambda-dev mailing list