On Dec 9, 2011, at 6:18 AM, Abdul Sowayan wrote:
> + (MyClass *)sharedInstance
> {
> static MyClass *sharedInstance = nil;
>
> if(sharedInstance == nil)
> {
> @synchronized(self)
> {
> if (sharedInstance == nil)
> sharedInstance = [[self alloc] init];
> }
> }
>
> return sharedInstance;
> }
Ah, wait. Somehow I misread that code. Nevermind my question about whether this
occurs in practice, but thanks go to Jean-Daniel and Andreas for their answers.
It's nice to know more about this. I guess I'm still wary about the whole "an
assignment may not be an atomic operation" thing on older CPUs that I did it
right "by accident" :-)
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]