这把锁有必要吗?
今天有空看了Double-checked locking and the Singleton pattern这篇文章.当看到
Double-checked locking: Take two
Given that the current double-checked locking code does not work, I've put together another version of the code, shown in Listing 7, to try to prevent the out-of-order write problem you just saw.
Listing 7. Attempting to solve the out-of-order write problem
这里时产生一个疑问.