How does multithreading on iPhone OS work? How do I use it?

10,571

Solution 1

With the NSThread class, yes, well, and yes. :-)

Solution 2

I would strongly suggest to have a look at the following documentation from Apple:

For most common concurrent programming operations the use of NSOperation and NSOperationQueue both part of Grand Central Dispatch is very easy to implement and will cover most of the operations you need to perform asynchronously including the definition of dependencies between such operations.

Using GCD is simpler that using threads and is going to completely replace them in situations where you don't need real time processing from a parallel thread.

Solution 3

If you want to develop efficient, smooth-running applications, controlling concurrency and memory are vital. Automatic Reference Counting is Apple's game-changing memory management system, new to Xcode 4.2. Pro Multithreading and Memory Management for iOS and OS X shows you how ARC works and how best to incorporate it into your applications. Grand Central Dispatch (GCD) and blocks are key to developing great apps, allowing you to control threads for maximum performance.
There is lots of books and courses available for it.

Solution 4

Using Grand Central Dispatch is the best way to multithread on the iPhone, it's not that difficult to implement if you stick to the rules. Check the documentation and programming guides.

Share:
10,571
Thanks
Author by

Thanks

I like to play guitar. Sometimes I need to develop software. But I hate it ;) I mean... it sucks. It really does. Well, not always. Oh, and I think I'm the guy with the most questions here.

Updated on June 17, 2022

Comments

  • Thanks
    Thanks almost 2 years

    I am curious about threads on iPhone. Are they easy to establish and to maintain? How does it work on the iPhone? Is it real multithreading?

  • orkoden
    orkoden over 11 years
    Exactly this. You should only use NSThreads if GCD somehow will not work.