Alternative to double-checked locking and the Singleton pattern
Singleton pattern is a well-known pattern in programming. Double-checked locking is an implementation of singleton pattern which is intended to be thread-safe. However it is found that this method is broken, unless memory barrier is used which may has problem of portability.
In this article, I am going to present an alternative to double-checked locking ...