NSThread vs. NSOperationQueue vs. ??? on the iPhone

Posted by kubi on Stack Overflow See other posts from Stack Overflow or by kubi
Published on 2010-06-15T00:24:28Z Indexed on 2010/06/15 2:22 UTC
Read the original article Hit count: 350

Filed under:
|
|
|

Currently I'm using NSThread to cache images in another thread.

[NSThread detachNewThreadSelector:@selector(cacheImage:) toTarget:self withObject:image];

Alternatively:

[self performSelectorInBackground:@selector(cacheImage:) withObject:image];

Alternatively, I can use an NSOperationQueue

NSInvocationOperation *invOperation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(cacheImage:) object:image];
NSOperationQueue *opQueue = [[NSOperationQueue alloc] init];
[opQueue addOperation:invOperation];

Is there any reason to switch away from NSThread? GCD is a 4th option when it's released for the iPhone, but unless there's a significant performance gain, I'd rather stick with methods that work in most platforms.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsthread