Skip to content

Instantly share code, notes, and snippets.

@ddribin
Created March 19, 2009 14:43
Show Gist options
  • Save ddribin/81846 to your computer and use it in GitHub Desktop.
Save ddribin/81846 to your computer and use it in GitHub Desktop.
static NSString * sVar1 = nil;
+ (NSString *)var1
{
// This used to be @synchronized(sVar1)
@synchronized(self)
{
if (sVar1 == nil)
sVar1 = [[self getValue] retain];
}
return sVar1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment