I’ve been spending this evening getting multithreading asset loading working. I’ve converted a lot of my iPhone code to C++ and keeping certain things as Objective-C objects only when I absolutely have to. This of course came back to bite me when trying to spawn off loading in a separate thread. Since the NSThread code expects a class object inherited from NSObject(id), it crashed everytime I passed it one of my C++ objects. I finally realized this and created a class wrapper whose only job is to be called by the thread and initiate the loading of the regular objects. Sure, it’s another layer, but now things are playing nice with one another and I can get on to the actual fun bits of the code.
Leave a reply