MT Safety Levels for Libraries
All routines that can potentially be called
by a thread from a multithreaded program should be MT-Safe.
This means that two or more activations of a routine must be able to correctly execute concurrently. So, every library interface that
a multithreaded program uses must be MT-Safe.
Not all libraries are now MT-Safe. The commonly used libraries that
are MT-Safe are listed in Table 6–3.
Additional libraries will eventually be modified to be MT-Safe.
Table 6–3 Some MT-Safe Libraries
Library
|
Comments
|
lib/libc
|
Interfaces that are not safe have thread-safe interfaces of the form *_r (often with different semantics)
|
lib/libdl_stubs
|
To support static switch compiling
|
lib/libintl
|
Internationalization
library
|
lib/libm
|
Math library compliant
with System V Interface Definition, Edition 3, X/Open and ANSI C
|
lib/libmalloc
|
Space-efficient memory allocation library; see malloc(3X)
|
lib/libmapmalloc
|
Alternative mmap(2)-based memory allocation library; see mapmalloc(3X)
|
lib/libnsl
|
The TLI interface, XDR, RPC clients
and servers, netdir, netselect and getXXbyYY interfaces are not safe, but have thread-safe interfaces of the form getXXbyYY_r
|
lib/libresolv
|
Thread-specific errno support
|
lib/libsocket
|
Socket library for making network connections
|
lib/libw
|
Wide character and wide string functions for supporting
multibyte locales
|
lib/straddr
|
Network name-to-address translation library
|
lib/libX11
|
X11 Windows library
routines
|
lib/libC
|
C++ runtime shared objects
|
Unsafe Libraries
Routines in libraries that are not guaranteed to be MT-Safe can safely
be called by multithreaded programs only when such calls are single threaded.