Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)
13 Porting Threaded Applications to the POSIX User Thread
(PUT) Model library
The POSIX User Model Thread library is a user-space implementation of IEEE Std 1003.1, 2004,
POSIX System Application Program Interface for use by native C and C++ TNS/E-targeted
applications in the OSS environment on NonStop servers. This library is supported on systems
running H06.21 and later H-series RVUs and J06.10 and later J-series RVUs. It is described in
detail in the Open System Services Programmer's Guide.
This chapter summarizes the information you need to port threaded applications that conform to
the IEEE Std 1003.1, 2004, POSIX System Application Program Interface. For information about
converting applications that use the Standard POSIX Threads library (T1248) to the POSIX User
Model Thread library, see the Open System Services Programmer's Guide
Throughout the rest of this chapter:
• The POSIX User Model Thread library is referred to as the PUT Model library
• The Standard POSIX Threads library is referred to as the SPT library.
Standards Conformance
The POSIX threads standard is officially described in Institute of Electrical and Electronics Engineers,
Inc., 2004 IEEE Std 1003.1-2001, IEEE Std 1003.1-2001/Cor 1-2002 and IEEE Std
1003.1-2001/Cor 2-2004. For simplicity, this manual refers to the “Standard document.” The
Standard document is available for purchase online at http://standards.ieee.org/.
Portable pthreads functions provided by the PUT Model library (designated with either the pthread_
or PTHREAD_ prefix and without the _np or _NP suffix) comply with the IEEE Std 1003.1, 2004,
POSIX System Application Program Interface.
In contrast to the SPT library, the PUT Model library does not provide these global variables because
these global variables are not specified in the final standard:
pthread_attr_default
pthread_mutexattr_default
pthread_condattr_default
Exceptions and Extensions to the Standard Document
Although the PUT Model library version of sigaction() accepts the SA_ONSTACK flag, the
PUT Model library determines which stack is used to run the thread signal handler. The PUT Model
library does not allow you to establish a signal stack using the sigaltstack() function. For
more information about this behavior, see the Open System Services Programmer's Guide.
These functions are not async-signal safe, so they should not be used in signal handlers:
alarm()
fork()
pause()
sigaction()
sigsuspend()
sleep()
wait()
waitpid()
Threads Portability
Using thread functions whose names end with _np (non-portable) decreases the portability of a
program, because these functions are extensions to the Standard document. Using the jacket
188 Porting Threaded Applications to the POSIX User Thread (PUT) Model library