Talk:Double-checked locking

From Wikipedia, the free encyclopedia

the proposed solution for DCL in java with the volatile keyword doesn't work

see here: http://www.javaworld.com/jw-02-2001/jw-0209-double.html?page=1 and here: http://www-128.ibm.com/developerworks/java/library/j-dcl.html


uh, AFAIK double checked locking is broken on JAVA, but it can work nicely in C and C++. the problem is, that in Java, you can't insert the required memory barriers...

Good news, Mr./Mrs. 84.157.213.97, perhaps you could add the details to the article? Seriously, I think the article should make clear how it applies to different languages, and should include a formal demonstration of how it can fail in a given memory model (or a proof that it cannot fail :)). PJTraill 18:32, 5 March 2006 (UTC) Aha, I realise that since I last looked a number of things have changed... But a summary of which versions x platforms it can work on would be useful. PJTraill 18:46, 5 March 2006 (UTC)


According to this article it is also problematic in C++. I found this link on the article page. Perhaps it was added after your comment or you just didn't bother to look at it. http://www.aristeia.com/Papers/DDJ_Jul_Aug_2004_revised.pdf