The various thread interfaces manipulate thread objects, application threads, anonymous threads, and keys. The following sections group the functions by these tasks and briefly describe them.
Application threads can be joinable, detached, or daemon threads. You schedule application threads for work when you call a thread create function. The following functions manage application threads:
Purpose |
Pthread Equivalent |
UI Equivalent |
NKS Function |
---|---|---|---|
Binds or unbinds a thread from a specified CPU. |
|||
Retrieves the current CPU binding for the calling thread. |
|||
Marks the specified thread for termination. The termination occurs when the thread reaches a library cancellation point. Normal termination is done with an exit function. |
|||
Causes the thread to exit. If the thread is a detached thread, all its resources are cleaned up. If the thread is a joinable thread, all its resources are not cleaned up until it reports or until the application exits. |
|||
Converts a joinable thread to a detached thread. |
|||
Joins the specified thread to the calling thread. The calling thread waits for the specified thread to exit. |
|||
Retrieves state information for the specified thread. |
pthread_attr_getstacksize pthread_attr_getstackaddr pthread_attr_getdetachstate |
||
Retrieves the thread ID for the calling thread. |
|||
Retrieves the priority of the thread. |
|||
Sets the priority of the specified thread. Currently, these functions do nothing because the scheduler in the NetWare operating system runs all threads at the same priority. |
Once you schedule an application thread, you can allow it to finish its work, or you can call one of the following functions to interrupt the work:
The following functions manage keys and their data.
UI threads do not have a separate object for managing the attributes of the thread, but both pthreads and NKS threads do. The pthread attribute object and the NKS thread context have functions which allow you to manage some of the same attributes.
The following pthread functions manage the pthread attribute object.
The following NKS functions create and manage NKS thread contexts.
You schedule anonymous threads for work when you call the following NKS functions:
Neither pthreads or UI threads have anonymous threads that process work. Although you can cancel a thread with pthread_cancel, this type of cancel is not the same as cancelling work. In NKS, you can only cancel work that is not currently running. Periodic work is cancelled by not putting it back on the run queue. Single-shot work is cancelled only if it is still in the run queue.