[concurrency-interest] How seriously should we take broken doublechecked idiom

Dawid Kurzyniec dawidk at mathcs.emory.edu
Tue May 3 14:45:47 EDT 2005

Bill Pugh wrote:

> Please tell me what project you work on so I can avoid it, or what  
> company you work for so I can short your stock.
> Like others, I am appalled at your tech lead's attitude towards  
> software reliability.
> There is essentially no cost to performing thread-safe lazy  
> initialization in a correct way, and several
> possible correct ways to accomplish it.
Not trying to argue with what you guys say and suggest as alternatives, 
I think you might be a bit too harsh in reacting to the question. After 
all, "double checked locking" idiom was once blessed and recommended, 
and, correct me if I am wrong, but I think I have seen several uses of 
it in core Java classes. It will take time and patience to educate 
people that it is not correct; also, I can understand that people may 
count that the idiom will work on SUN JVMs even though not guaranteed by 
the spec, just because SUN once was using it in its own code. Even 
though this expectation may be unjustified, especially on SMP machines, 
still - educating (and especially un-educating) people always takes time 
and patience. Also, after all, the fact that this question was asked on 
this forum suggests that the company might actually be quite sane :)

Just my 2c,
Dawid Kurzyniec

More information about the Concurrency-interest mailing list