Sunday, February 12, 2012

Example of Locking with Grand Central Dispatch

@synchronized is out, GCD is in. Who knew? Anyway, an example of locking with GCD. Works EXACTLY the same as @synchronized, only better (but don't take my word for it, profile and tell me how it went: the major risk is that you'll never be iterating enough to care, but the evils of preoptimization have been completely overblown).

No comments: