A Simple Job Queue With Grand Central Dispatch

In my last two posts, we talked about the basics of GCD and then delved into blocks. Now we’re going to start learning how to replace your old threading code with GCD. For this post, we’ll discuss how to create a simple sequential job queue using dispatch_async and friends. (more…)



Being a Blockhead

Last time I talked about asynchronous behavior via Grand Central Dispatch. One of the core features that makes this all possible is blocks. I thought I’d take a step back this time and just talk about blocks themselves and how they can be used by your code. (more…)



Threading is Dead. Long Live Threading!

I stated in a past post that threads are evil. I still stand by that statement. Adding threads to an application has historically been fraught with issues. Many stem from people not quite understanding all of the situations can arise, etc. Oh sure, you might know what a deadlock is, but do you know all the circumstances they can occur? How does one safely shut a thread down? Did the owning object go away? It’s not as simple as it seems in most cases.

But what if I could thread until the break of dawn and not have to worry as much about those situations? That’s exactly what Grand Central Dispatch gives you on Mac OS X, and now iOS — access to concurrency without nearly as much pain. (more…)