Skip to content

Instantly share code, notes, and snippets.

@netshade
Created February 4, 2011 15:27
Show Gist options
  • Save netshade/811231 to your computer and use it in GitHub Desktop.
Save netshade/811231 to your computer and use it in GitHub Desktop.
@interface SomeSingleton {
uint8_t * someBlockOfMemory;
}
@property(readwrite, atomic, assign) uint8_t * someBlockOfMemory;
+(id) sharedInstnace;
@end
// Thread A
SomeVolatileActionOn([[SomeSingleton sharedInstance] someBlockOfMemory]);
// Thread B
SomeVolatileActionOn([[SomeSingleton sharedInstance] someBlockOfMemroy]);
^ not thread safe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment