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 (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to