Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
6 lines (4 sloc) 638 Bytes
A Singleton Macro that swaps method implementations at runtime so that only the initialization portion will require syncrhonization (lock).
- Specifically it uses method_setImplementation() to dynamically replace the sharedInstance access method with one that does not instantiate a new object and thus does not require @synchronized.
It is based on the work here: by Matt Gallagher
But changing the implementation to use method swizzling as described here: by Dave MacLachlan of Google.