Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSThread VS pthreads

What is the difference between NSThread and pthread? Does NSThread use pthread as its internal implementation and do we really need the extra overhead of NSThread when pthreads suffice especially on the iPhone.

like image 832
shreyasva Avatar asked Dec 05 '10 13:12

shreyasva


1 Answers

I don't know for sure if NSThread use pthreads library internally. It probably does, but since we don't have source code for NSThread we really don't know.

The difference is that pthread is a C library and NSThread is an Objective-C library. But they both accomplish the same functionality.

The need for an Objective-C library is if you need to use it in combination with other portions of Objective-C API. I.E., you won't be able to store a pthread in a NSArray.

like image 183
Pablo Santa Cruz Avatar answered Sep 30 '22 12:09

Pablo Santa Cruz