Re:Singleton Pattern in Go
by maxlybbert on Monday July 13, 2015 @08:52PM
(#9882199)
A few years ago, the C++ standard didn't guarantee that the double-checked idiom would work. Even if your threading library had some way to insert the necessary memory barriers, it was possible that your compiler would optimize important things away.
C++11 changes that. The language now has standard ways to add memory barriers, and compiler optimizations can't remove them.
C++11 changes that. The language now has standard ways to add memory barriers, and compiler optimizations can't remove them.