interfaces' (API) specified by the international formal standard POSIX 1003.1c-1995. This standard was approved by the IEEE in June 1995. A new edition of POSIX 1003.1, called
As I explained in the preface, I will use the informal term 'Pthreads' to refer to 'POSIX 1003.1c-1995.' I will use the slightly more formal term 'POSIX.1b' to refer to 'POSIX 1003.1b-L993' in the text, 'POSIX.14' to refer to the POSIX 1003.14 'Multiprocessor Profile,' and similar abbreviated notation for other POSIX standards. I'll use the full names where precision is important, for example, to compare POSIX 1003.1-1990 and POSIX 1003.1-1996, and also in section titles and captions that appear in the table of contents.
1.9.1 Architectural overview
You may remember from Section 1.2 that the three essential aspects of a thread system are execution context, scheduling, and synchronization. When you evaluate any thread system, or compare any two thread systems, start by categorizing the features into capabilities that support execution contexts, scheduling, and synchronization.
With Pthreads, you create an execution context (thread) by calling pthread_ create. Creating a thread also schedules the thread for execution, and it will begin by calling a 'thread start function' that you specified. Pthreads allows you to specify scheduling parameters either at the time you create the thread, or later on while the thread is running. A thread normally terminates when it calls pthread_exit, or returns from the thread start function, although we will encounter a few other possibilities later.
The primary Pthreads synchronization model uses
1.9.2 Types and interfaces
This section briefly outlines the Pthreads data types, and some of the rules for interpreting them. For a full description of the 'object' represented by each type and how to create and use those objects in a program, see the appropriate sections later in this book, as shown in Table 1.2.
Type | Section | Description |
pthread_t | 2 | thread identifier |
pthread_mutex_t | 3.2 | mutex |
pthread_cond_t | 3.3 | condition variable |
pthread_key_t | 'access key' for thread-specific data | |
pthread_attr_t | 5.2.3 | thread attributes object |
pthread_mutexattr_t | 5.2.1 | mutex attributes object |
pthread_condattr_t | 5.2.2 | condition variable attributes object |
pthread_once_t | 'one time initialization' control context |
TABLE 1.2
AII Pthreads types are 'opaque.' Portable code cannot make assumptions regarding the representation of these types.
All of the 'pthread' types listed in Table 1.2 are considered
1.9.3 Checking for errors