Dev:Singleton pattern

The traditional singleton creation is extremely inefficient because @synchronized not only lock a mutex, but also insert an exception handler (try/catch block). If you don't care about exceptions and willing to use C functions, pthread_once is a better alternative: As of iOS 4, you can also use libdispatch, for example: pthread_once is implemented using a spin lock (which leads to a syscall_thread_switch kernel call in the worst case).

If it is safe to create multiple copies of the singleton and destroy the extra ones, you may even use CAS: Unfortunately, OSAtomicCompareAndSwapPtrBarrier on ARMv4 is implemented using a global spin lock, so in principle this is nowhere faster than pthread_once, and is even more error-prone. On ARMv6 it is implemented as a LDREX/STREX pair :