C and C++ compilation system

Reentrant libraries

The traditional SCO OpenServer process could be characterized as having a single flow of control. Global data structures were guaranteed to be consistent, in the absence of signal handlers that might modify the global data or if inter-process shared memory was not used. Global variables could be counted on to retain their most recently set value throughout the process, since no other flow of control could be changing it "behind your back".

Multi-threaded applications allow for multiple flows of control through a process. Each flow of control, or thread, shares access to the global variables and data space of the overall process. This includes global and static scope variables as well as the heap storage managed by the C library memory allocation routines. There is nothing that magically prevents multiple threads within a process from interfering with each other in a way that causes data corruption. Reentrant or thread safe libraries, therefore, must guarantee synchronized access to their own global data or functions.

The following libraries are reentrant:

When building a multithreaded application, you must pass -K thread to the cc command. This enables your application to see thread-safe interfaces from the system headers.

For details on multithreaded programming, see Programming with system calls and libraries. The C++ standard library, libC, is reentrant (except for the old, pre-standard iostreams classes kept for compatibility, which are not).

Next topic: BSD system libraries and header files
Previous topic: Using Command Line Arguments to Set Flags

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005