Using the NSThread Class

Several features of the Application Kit make use of threads. For example, in the previous NSTask examples, the task itself is actually run from a separate thread. Many of the animations in Aqua, such as throbbing buttons and progress meters, are also run from other threads. All these threads are entirely transparent to the programmer. For programmer-controlled threads, however, the NSThread class is the Cocoa interface to the operating system’s thread functionality. On Mac OS X, the pthreads library is the underlying functionality being tapped. Although the full functionality of pthreads is not available through the NSThread interface, the careful programmer can get away with calling the pthread functions when and if ...

Get Cocoa® Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.