Reputation: 849
If I would like to do number of function at a time without much loading then for that which option is best (for the purpose of less loading, fast execution & crash issues)...
1). NSThread
2). performSelectorInBackground
3). NSOperationQueue
Or any other than the above all? Please suggest me the best & the appropriate solution. Thnaks in advance for all the links & guidance.
Upvotes: 1
Views: 48
Reputation: 4140
Grand Central Dispatch would be the best I think.
// Job 1
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
// Heavy work here...
});
// Job 2
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
// Heavy work here...
});
And if you want to do something on the main thread from within those (eg. updating UI), use:
dispatch_sync(dispatch_get_main_queue(), ^{
// Update UI...
});
Upvotes: 2