Created
February 6, 2015 15:11
-
-
Save joncham/dee87d5ce78797cc3df8 to your computer and use it in GitHub Desktop.
Double Check Locking Style
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!value) | |
{ | |
AutoLock lock (&theLock); | |
if (!value) | |
{ | |
//... | |
value = /// | |
} | |
} | |
// vs | |
if (value) | |
return value; | |
AutoLock lock (&theLock); | |
if (value) | |
return value; | |
//... | |
value = /// | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment