JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Multithreaded Programming Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

1.  Covering Multithreading Basics

2.  Basic Threads Programming

3.  Thread Attributes

4.  Programming with Synchronization Objects

5.  Programming With the Oracle Solaris Software

6.  Programming With Oracle Solaris Threads

7.  Safe and Unsafe Interfaces

Thread Safety

MT Interface Safety Levels

Reentrant Functions for Unsafe Interfaces

Async-Signal-Safe Functions in Oracle Solaris Threads

MT Safety Levels for Libraries

Unsafe Libraries

8.  Compiling and Debugging

9.  Programming Guidelines

A.  Extended Example: A Thread Pool Implementation

Index

MT Safety Levels for Libraries

All routines that can potentially be called by a thread from a multithreaded program should be MT-Safe. Therefore, 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 the following table. The libraries are accessed in the /usr/lib directory.

Table 7-3 Some MT-Safe Libraries

Library
Comments
libc
Interfaces that are not safe have thread-safe interfaces of the form *_r, often with different semantics.
libm
Math library that is compliant with System V Interface Definition, Edition 3, X/Open, and ANSI C
libmalloc
Space-efficient memory allocation library, see malloc(3MALLOC)
libmapmalloc
Alternative mmap-based memory allocation library, see mapmalloc(3MALLOC)
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
libresolv
Domain name server library routines
libsocket
Socket library for making network connections
libX11
X11 Windows library routines
libCrun
C++ runtime shared objects for Oracle C++ 5.0 compilers
libCstd
C++ standard library for Oracle C++ 5.0 compilers
libiostream
Classic iostream library for Oracle C++ 5.0 compilers
libC.so.5
C++ runtime and iostream library for Oracle C++ 4.0 compilers

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.