Pthread Stubs in C Library

Pthread stubs in C library - Release Notes
Problem
On HP-UX if a non-threaded application links to a thread-safe library, calls to thread safe routines from the
application fail at run time due to unresolved symbols of the form of pthread_*. To resolve these symbols it is
necessary to link the non-threaded application to a threads library (libpthread or libcma). But linking to that library
forces the application to use thread-safe features even if it creates no threads, with subsequent loss of performance.
Resolution
Due to the problems stated above, HP has decided to implement POSIX 1x thread stubs.
Providing POSIX 1c thread stubs in HP-UX C language library have two direct effects for non-threaded applications:
a) POSIX 1c thread symbols are resolved if a non-threaded application links to a thread-safe library.
b) We avoid the overhead of a real thread library especially the overhead associated with mutexes when the non-
threaded application uses thread stubs rather than the real thread library procedures.
As per the libc cumulative patches, PHCO_22923 (11.00) and PHCO_23772 (11.11), the libc shared library contains
stubs for the pthread_* functions in libpthread and libcma. The stubs allow non-threaded applications to dynamically
load thread-safe libraries successfully, so that the pthread symbols are resolved. Applications that resolves pthread/cma
calls to the stub must be built without -lpthread or -lcma on the link line.
Stubs provided in libc do not have any functionality, these are dummy functions returning zero except
pthread_getspecific() family of APIs which has full functionality implemented in the stubs.
List of pthread calls for which the stubs are provided in the C library is given below.
pthread_atfork(3T)
pthread_attr_destroy(3T)
pthread_attr_getdetachstate(3T)
pthread_attr_getguardsize(3T)
pthread_attr_getinheritsched(3T)
pthread_attr_getschedparam(3T)
pthread_attr_getschedpolicy(3T)
pthread_attr_getscope(3T)
pthread_attr_getstackaddr(3T)
pthread_attr_getstacksize(3T)
pthread_attr_setdetachstate(3T)
pthread_attr_setguardsize(3T)
pthread_attr_setinheritsched(3T)
pthread_attr_setschedparam(3T)
pthread_attr_setschedpolicy(3T)
pthread_attr_setscope(3T)
pthread_attr_setstackaddr(3T)
pthread_attr_setstacksize(3T)
pthread_cancel(3T)
pthread_cond_broadcast(3T)
pthread_cond_destroy(3T)
pthread_cond_init(3T)
pthread_cond_signal(3T)
pthread_cond_timedwait(3T)
pthread_cond_wait(3T)

Summary of content (7 pages)