Re: Global in NSApplication
Re: Global in NSApplication
- Subject: Re: Global in NSApplication
- From: Graham Cox <email@hidden>
- Date: Thu, 28 Jan 2010 09:01:09 +1100
On 28/01/2010, at 8:51 AM, Scott Ribe wrote:
> The code you posted has a race condition, and can create multiple instances
> when called from different threads.
Ah, that's different. I understood you to mean that it ALWAYS created multiple instances.
Any threaded programming requires a lot of care, this is no exception. The Cocoa Fundamentals Guide has a section on creating a true singleton - I thought it also dealt with thread safety but having just looked it up it doesn't.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden