site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com BOOL variable_initialized=NO; void* myVariable; NSLock* myLock; // assume lock has been initialized in main - (void)isThisThreadSafe; { if ( !variable_initialized ) { [myLock lock]; if ( !variable_initialized ) myVariable = allocateStuff(); variable_initialized = YES; [myLock unlock]; } return myVariable; } Can anyone confirm this, or offer advice on an alternate solution? Thanks. -steve
participants (1)
-
Steve Gehrman