Skip to content

A Singleton Macro that swaps method implementations at runtime so that only the initialization portion will require syncrhonization (lock)

Notifications You must be signed in to change notification settings

dymv/Objective-C-Optimized-Singleton

This branch is 1 commit ahead of, 1 commit behind cjhanson/Objective-C-Optimized-Singleton:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jun 25, 2012
d1da2da · Jun 25, 2012

History

10 Commits
Mar 2, 2010
Jun 25, 2012

Repository files navigation

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: http://cocoawithlove.com/2008/11/singletons-appdelegates-and-top-level.html  by Matt Gallagher
But changing the implementation to use method swizzling as described here: http://googlemac.blogspot.com/2006/11/synchronized-swimming-part-2.html by Dave MacLachlan of Google.

About

A Singleton Macro that swaps method implementations at runtime so that only the initialization portion will require syncrhonization (lock)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%