What is the iOS thread model?

1.1k views Asked by At

I have used Java threads and POSIX threads in C before. Recently I am learning iOS. It seems to me that iOS thread model is a bit different. In particular there are runloops associated with threads and you can call methods on particular threads. I did not see anything like this in Java thread or pthread. Can anyone please explain to me the iOS thread model comparing it to Java thread or pthread?

2

There are 2 answers

0
Pardeep Bishnoi On

You can learn more about thread on official apple documentation and also learn about concurrency in iOS.

0
inspector_60 On

Apple implemented a high level library called libdispatch commonly known as grand central dispatch (GCD) this library provides support for concurrent code execution.

Apple encourage developers to use GCD and not threads and POSIX - even though you can use it since GCD is built on top of it.

GCD is very simple and easy to use, a good start will be to read this tutorial, to go a bit deeper you can check out this article(objc) and here is a swift version