Книга: Programming with POSIX® Threads

1.9.2 Types and interfaces

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 5.4 "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 POSIX threads types

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 opaque. There is no public definition of these types' representation, and programmers should never assume anything about the representation. You should use them only in the manner specifically described by the standard. A thread identifier, for example, may be an integer, or a pointer, or a structure, and any code that uses a thread identifier in a way that is not compatible with all of those definitions is incorrect.

Оглавление книги


Генерация: 0.749. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз