Skip to content

Instantly share code, notes, and snippets.

@finestructure
Created March 12, 2012 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save finestructure/2021644 to your computer and use it in GitHub Desktop.
Save finestructure/2021644 to your computer and use it in GitHub Desktop.
Blocking valueForKey:
- (NSString *)valueForKey:(NSString *)key {
__block NSString *result = nil;
do {
// keep polling until there's a value
dispatch_sync(valuesSerialQueue, ^{
result = [self.values objectForKey:key];
});
} while (result == nil);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment