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

Kessel, Chris ckessel at c-cor.com
Wed Dec 20 16:27:45 EST 2006


>The field x is accessed in a thread-safe manner in Moo, but the class 
>Foo is not thread-safe.  The thread-safety is provided by the locking
in 
>Moo.

Ah, good point.  An external class can provide the thread safety
(client-side locking I think was the JCiP term?).

But, good to know I understand correctly.  The reason I questioned
myself was that I've seen precious few thread safe classes. I've rarely,
if ever, seen much attention paid to making sure each instance field is
properly protected.  A few assessors might be synchronized, but the
thread-safety considerations are ad-hoc at best.

Chris




More information about the Concurrency-interest mailing list