-mt

The -mtoption enables multi-threading capability without the need to set any other flags, such as -land -D. HP aC++ examines your environment and automatically selects and sets the appropriate flags. “Performance Options” (page 167).

There are three possible sets of flags depending on your operating system and the libstd you use. Table 5 lists the option matrix for -mt.

Table 5 Option Matrix for -mt

Libraries

Flags

 

 

old-lib

-D_REENTRANT

libstd 1.2.1

-DRW_MULTI_THREAD

(-AP)&

-DRWSTD_MULTI_THREAD

librwtool 7.0.x

-D_THREAD_SAFE

 

-D_POSIX_C_SOURCE=199506L

 

-D_HPUX_SOURCE *

 

-lpthread

 

 

new-lib

-D_REENTRANT

(-AA)

-D_RW_MULTI_THREAD

libstd 2.2.1

-D_RWSTD_MULTI_THREAD

 

-D_POSIX_C_SOURCE=199506L

 

-D_HPUX_SOURCE *

 

-lpthread

 

 

C mode

-D_REENTRANT

-Ae/-Aa

-D_POSIX_C_SOURCE=199506L

 

-lpthread

 

 

* required if -D_POSIX_C_SOURCEis used.

NOTE: For C++ and C -Ae-D_HPUX_SOURCE is set to be compatible with the default when -mtis not used. For C mode options -AC89, -AC99, and -Aa, -D_HPUX_SOURCEis also set. If you do not want to use-D_HPUX_SOURCE, you can undefine it by using -U. Example:

-U_HPUX_SOURCE

The following macros are used to compile multi-thread source code:

_REENTRANT

Required by system header files that provide reentrant functions (suffixed by _r).

RW_MULTI_THREAD / _RW_MULTI_THREAD

Required by Rogue Wave toolsh++ header files and libraries. RW_MULTI_THREAD is used by toolsh++ 7.0.x. _RW_MULTI_THREAD is used by toolsh++ 8.x (not available yet).

RWSTD_MULTI_THREAD / _RWSTD_MULTI_THREAD

Required by Rogue Wave standard library header files and libraries. RWSTD_MULTI_THREAD is used by libstd 1.2.1. _RWSTD_MULTI_THREAD is used by libstd 2.2.1 when compiling with -AA.

66 Command-Line Options