What that paper says is that the double-checked locking idiom *as commonly applied* is broken. See a more recent description of the correct use of double-checked locking, including a discussion of when it is appropriate, in Effective Java, 2nd edition.
AFAIK, the Restlet codebase is doing things correctly, but I could have missed something. If you have a specific case that appears to be broken, let me know.
--tim
On Fri, Sep 25, 2009 at 6:30 AM, Jerome Louvel
<[hidden email]> wrote:
Hi
guys,
Ivan
Gorgiev came across a subtle multi-threading issue as described here:
“Synchronization
issues with Template”
http://restlet.tigris.org/issues/show_bug.cgi?id=881
It
appears that the “double-check locking” pattern that we use in many
places in Restlet code doesn’t work reliably in some environments (AMD-64
in his case).
He
further points to this web page which worries me:
“The
"Double-Checked Locking is Broken" Declaration”
http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
I’d
like to get the opinion of concurrency experts in this list to see if we better
synchronize all those lazy creation methods instead?