With LibC, you can create two categories of threads:
Application threads, which an application manages. These threads can be joinable or detached threads (which the NKS, pthread, and UI interfaces can create) or daemon threads (which only the NKS interface can create). Each application thread is assigned a unique identifier whose scope is local to the containing NLMâ„¢.
Anonymous threads, which LibC manages. Only the NKS interface enables the creation of this type of thread.
The following table describes the types of tasks these thread types can perform.
Thread type determines a number of the characteristics of the thread and the scope of its influence. For example, if all joinable and detached threads exit, the application exits. Daemon and anonymous threads do not participate in the decision to exit.
On a multiprocessor machine, you can request that a specific CPU execute a thread. Thread type determines the significance of such a request:
For anonymous threads, such a request is only advisory, and the operating system can ignore the request.
For detached, joinable, and daemon threads, such a request becomes a requirement, and the operating system enforces the request.
Thread type also determines the life of a context. You can optionally bind application threads (joinable, detached, daemon) to their context:
If bound, the context is destroyed and its resources freed when the thread exits after completing its work.
If not bound, the context is not destroyed and can be used again when the thread exits after completing its work. An application must manage such a context and free its resources when it is no longer needed.
For information about the NKS functions you can use to create these types of threads, see Application Thread Functions and Anonymous Thread Functions.