Since Doug and I keep getting questions asking us to explain why the
double-checked locking idiom is broken, I've written a web page that
tries to explain it in a fair bit of detail.
http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
This document describes why the double-checked locking pattern is
broken unless you use explicit memory barriers (or make assumptions
about your processor and compiler); since you don't have those
options in Java, it is broken in Java.
Please provide me with feedback on how to improve this document.
To show that it isn't just one crazy guy saying this, I am asking
people who understand the issue to sign it. Don't sign it just
because you believe me; sign it because you understand the issue and
can explain it to someone else. To sign it, just send me email and
I'll add your name.
Bill
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:26 EDT