pthread_scope_options.5 (2010 09)

p
pthread_scope_options(5) pthread_scope_options(5)
default_scope_system
If contention scope is set by pthread_attr_setscope()
, that scope is considered while creating a
thread. Otherwise,
PTHREAD_SCOPE_SYSTEM
is considered.
Note: The properties file options mxnfromcompatmode
and
all1x1 supported on HP-UX 11i v2 will
be provided for backward compatibility. However, if any of the above mentioned new properties file
options are used,
mxnfromcompatmode
and all1x1 will not have any effect.
3. Environmental Variables
There are a set of environment variables which when set can override the scope of the threads specified in
the application. These environment variables should be set before starting the application to run.
The environmental variables supported for controlling the scope are:
PTHREAD_FORCE_SCOPE_SYSTEM
Forces the system scope irrespective of scope specified in the attribute for thread creation.
PTHREAD_FORCE_SCOPE_PROCESS
Forces the process scope irrespective of scope specified in the attribute for thread creation.
PTHREAD_DEFAULT_SCOPE_PROCESS
If contention scope is set by pthread_attr_setscope()
, that scope is considered while creat-
ing a thread. Otherwise,
PTHREAD_SCOPE_PROCESS
is considered.
PTHREAD_DEFAULT_SCOPE_SYSTEM
If contention scope is set by pthread_attr_setscope()
, that scope is considered while creat-
ing a thread. Otherwise,
PTHREAD_SCOPE_SYSTEM
is considered.
Note: PTHREAD_COMPAT_MODE
environment variable that was supported on HP-UX 11i v2 will con-
tinue to be supported and will have the same effect as
PTHREAD_FORCE_SCOPE_SYSTEM
However, if
any of the above mentioned new environment variables are set,
PTHREAD_COMPAT_MODE
will not have
any effect.
Precedence if multiple options are specified:
Environmental variable settings take higher precedence over properties file settings which in turn
take higher precedence over compile time options.
If more than one setting is done in one of the ways specified above, force option will take higher pre-
cedence over default option and the scope set by
pthread_attr_setscope()
. System scope takes
more precedence than process scope. The contention scope set by
pthread_attr_setscope()
takes precedence over external scope setting for default scope process and default scope system.
EXAMPLES
1. The following settings are done in properties file:
force_scope_system 1
default_scope_process 1
export PTHREAD_TUNE=1 and
export PTHREAD_PROPERTY_FILE=user’s_properties_file
should be done for the properties file to be read by the pthread library.
If
PTHREAD_PROPERTY_FILE is not set, /usr/lib/libpthread.properties
will be used.
With these settings,
force_scope_system will take the precedence, and system scope will be
forced for all thread creations.
2. If the following options are defined at compile time with
-D or defined in one of the application header
files: PTHREAD_DEFAULT_SCOPE_SYSTEM and PTHREAD_FORCE_SCOPE_SYSTEM;
PTHREAD_FORCE_SCOPE_SYSTEM will take higher precedence, and system scope threads will be
forced even when pthread_attr_setscope() is used to specify the process scope.
3. If the following environmental variables are set (say, using sh-posix):
export PTHREAD_DEFAULT_SCOPE_PROCESS=1
export PTHREAD_FORCE_SCOPE_SYSTEM=ON
PTHREAD_FORCE_SCOPE_SYSTEM will take higher precedence, and system scope is forced for all
the threads created in the process.
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010