[concurrency-interest] Basic thread safety question:final/volatile/synchronized fields

Kessel, Chris ckessel at c-cor.com
Wed Dec 20 17:54:15 EST 2006


>Safe publication means transmitting the object to another thread by
>means of a shared lock or volatile (that is, a "happens before"
>relationship).

>Passing an object through a thread-safe queue is a common means of
>safe publication.

This is where I commonly get confused because of reachability concerns,
such as your typical parent-child relationships.  If object A is
effectively immutable I understand it's published safely through a
thread-safe queue. But what about the references held by A?  If A has a
reference to B, is B also then considered to be safely published?

Chris



More information about the Concurrency-interest mailing list