Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)
12 Porting Threaded Applications from the Draft 4 Standard
to the Standard POSIX Threads Library
This chapter summarizes the information you need to port existing threaded applications from the
Draft 4 to the Standard POSIX Threads library (T1248). In particular, this chapter summarizes
considerations for porting HP NonStop Distributed Computing Environment (DCE) Threads
applications, and gives pointers to sources of detailed information.
For information about porting threaded applications to the POSIX User Thread (PUT) Model library
in the OSS environment, see “Porting Threaded Applications to the POSIX User Thread (PUT) Model
library” (page 188). For information about migrating applications that use the Standard POSIX
Threads library to the POSIX User Thread (PUT) Model library, see the Open System Services
Programmer’s Guide.
The Standard POSIX Threads library (T1248), adheres to International Standard ISO/IEC 9945-1;
1996 (E) IEEE Std 1003.1,1996 (Incorporating ANSI/IEEE Stds 1003.1-1990, 1003.1b-1993,
1003.1c-1995, and 1003.1i-1995) (summarized as IEEE POSIX Standard 1003.1c), with the
following exceptions:
• The header file is called spthread.h instead of pthread.h.
• The thread-aware declarations for standard POSIX APIs must be obtained from the spthread.h
header file.
• Function behaviors and errors returned might differ. For detailed information about standards
conformance for a function, see the reference page for that function either online or in the
Open System Services System Calls Reference Manual or the Open System Services Library
Calls Reference Manual.
• For H06.21 and later H-series RVUs and J06.10 and later J-series RVUs, to use the Standard
POSIX Threads library, you must specify the _SPT_MODEL_ define in addition to including the
spthread.h header file. For more information, see the Open System Services Programmer's
Guide.
For more information about application programming with the Standard POSIX Threads library in
the OSS environment, see the Open System Services Programmer’s Guide.
Change in Error Reporting
One significant global change you should make to threaded applications that conform to the Draft
4 standard involves error reporting. In the final IEEE 1003.1c standard, errors are not reported in
errno but are returned as a status or error value, such as EINVAL. The errors supported by
Standard POSIX Threads are described in the Standard document. Note that the error values
returned are in many cases the values that were previously stored in errno.
186 Porting Threaded Applications from the Draft 4 Standard to the Standard POSIX Threads Library