Friday, March 4, 2011 [Tweets] [Favorites]

A Tour of OSAtomic

Mike Ash:

To see how you can use these, let’s consider how you would write OSAtomicAdd32 using compare and swap. Again, it works using a transaction model. First, fetch the original value. Then add to obtain a new value. Finally, use compare and swap with the original and new values. If it failed, go back and try everything again.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment