February 2009 Archives
Yeah, I’m a retro gaming junkie, so this one immediately caught my eye: D-Pad Hero. It’s a new game for the Nintendo Entertainment System (NES) that, you guessed it, is inspired by the ever popular Guitar Hero. It’s got four songs you can play along with:
- Sweet Child o’ Mine, Guns N’ Roses
- The Way You Make Me Feel, Michael Jackson
- Harder, Better, Faster, Stronger, Daft Punk
- The Swing of Things, A-Ha
It’s a free download, and you can play it on an NES emulator. It worked great in Nestopia, for me. Chiptune remakes are always fun, and I’d have to say Sweet Child o’ Mine is my favorite song. I haven’t actually played it too much, yet, though.
A few weeks ago, Mike Ash wrote up a fantastic article about thread safety on OS X. Apple’s pushing technologies like
NSOperation, currently available on 10.5, and Grand Central, available in the upcoming 10.6 release, in order to help developers utilize all CPU cores and ease the pains of threaded programming, so thread safety is an important topic. One of the key points to his article was the difference between “not thread safe” and “main thread only,” and I think this topic deserves a closer look.
There are two problems with the current state of affairs. First, the documentation is poor. Apple’s API documentation often does not distinguish between “not thread safe” and “main thread only.” The second is that many classes, documented or not, are only safe to use from the main thread.
Both of these problems are important because knowing this information impacts how you write your code. The result is that your architecture is limited to main thread only. Main thread only complicates your code, plus it means you don’t get to use
NSOperation or Grand Central at all or to their fullest extent.
Before I delve into some more concrete examples of how the current situation affects architecture, I’d like to discuss why you would ever use multiple threads.