cjhanson/Objective-C-Optimized-Singleton

Why not use +(void)initialize?

rpetrich opened this issue · 2 comments

+initialize is guaranteed to be called from inside the Objective-C runtime lock the first time the target class receives a message.

The current implementation supports teardown and deallocation. If you used initialize you'd only get it called once for the entirety of the application lifetime.

Unless I've misinterpreted your implementation, purgeSharedInstance is completely unthreadsafe and should only be used on app shutdown anyway. Resurrecting the singleton in that case is of little use.