On Apr 16, 2011, at 9:04 PM, WT wrote: > Among other things, I wanted to replace my usage of @synchronized > singletons...
Why? As a learning experience, experimenting with GCD, what you're doing is somewhat instructive. But your stated goal seems pointless to me. Whether you use @synchronized, explicit NSLocks, pthread locks, OS spinlocks, OS atomics, memory barriers, or inject a tiny bit of C++ (the ability to assign the result of a computation to a static) + a compiler option (ensure statics are only initialized once) is unlikely to affect anything. > I have a singleton that takes care of all things core data (well, all things > that can be done generically). Likewise, I have a singleton for locale > "utilities". All my number and date formatters are there, in one place, > created once on demand and accessible everywhere else through the singleton. > That's the kind of usage I have for singletons. Well, maybe it is time for a philosophical discussion. You could go through all the work of making these into true singletons and calling a method to access them for every single use, or you could initialize a handful of globals at startup and just use them. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice _______________________________________________ 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