`NSThread` is part of the Objective-C Foundation Framework and provides developers a way to create and manage threads.
An instance of NSThread
controls a thread of execution. Developers can use this class when they would like to perform a series of tasks in its own thread of execution. An example is if the developer wanted to have an Objective-C method run in its own thread of execution.
Threads are useful for long-running tasks that avoid blocking the main thread of the application (where user interface and event-related tasks are handled), as well as dividing a large task into several smaller sub-tasks. This can lead to performance improvements.
In GNUStep, NSThread
essentially encapsulates OpenStep threading. Each process starts with a main thread and additonal threads can be created by using NSThread
. The GNUStep implementation of OpenStep was designed so that the internals of the base library do not use threading (except in the case of methods that explicitly deal with threads). This makes it possible to write applications without any sort of threading.
References