Double-checked locking in .NET
Double-checking locking now works in Java as well as C# (the Java memory model changed and this is one of the effects). However, you have to get it exactly right. If you mess things up even slightly, you may well end up losing the thread safety. As other answers have stated, if you’re implementing the … Read more