> Safe publication _is_ needed to ensure that thread2 will
> terminate, right?
Right.
>The point is that a data race on the reference to
> the published object is probably bad for reasons that may have nothing to
> do with the final fields, but that getting rid of that data race also
> eliminates the need for the special semantics for final fields for
> safely constructed objects. This latter claim could be wrong--but
> if it is, I'd appreciate an explanation.
True in your code sample. However, in general, safely constructed
objects with non-final fields are potentially subject to further
modification, and therefore potential data races.
As far as thread-safety is concerned, final fields are preferred over
non-final fields, whenever it is permissible.
Hanson Char
_______________________________________________
Concurrency-interest mailing list
Concurrency-interest@...
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest