United States-English |
|
|
HP-UX Reference > Ppthread_attr_getdetachstate(3T)Pthread LibraryHP-UX 11i Version 3: February 2007 |
|
NAMEpthread_attr_getdetachstate(), pthread_attr_getguardsize(), pthread_attr_getinheritsched(), pthread_attr_getprocessor_np(), pthread_attr_getschedparam(), pthread_attr_getschedpolicy(), pthread_attr_getscope(), pthread_attr_getstackaddr(), pthread_attr_getstacksize(), pthread_attr_getstack(), pthread_attr_getrsestacksize_np(), pthread_attr_setdetachstate(), pthread_attr_setguardsize(), pthread_attr_setinheritsched(), pthread_attr_setprocessor_np(), pthread_attr_setschedparam(), pthread_attr_setschedpolicy(), pthread_attr_setscope(), pthread_attr_setstackaddr(), pthread_attr_setstacksize(), pthread_attr_setstack(), pthread_attr_setrsestacksize_np() — get and set thread attributes SYNOPSIS#include <pthread.h> int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate); int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate); int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize); int pthread_attr_getstacksize(const pthread_attr_t *__restrict attr, size_t *__restrict stacksize); int pthread_attr_setrsestacksize_np(pthread_attr_t *attr, size_t rsestacksize); int pthread_attr_getrsestacksize_np(const pthread_attr_t *__restrict attr, size_t *rsestacksize); int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr); int pthread_attr_getstackaddr(const pthread_attr_t *__restrict attr, void **__restrict stackaddr); int pthread_attr_setstack(pthread_attr_t *attr, void *stackaddr, size_t stacksize); int pthread_attr_getstack(const pthread_attr_t *__restrict attr, void **__restrict stackaddr, size_t *__restrict stacksize); int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize); int pthread_attr_getguardsize(const pthread_attr_t *__restrict attr, size_t *__restrict guardsize); int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched); int pthread_attr_getinheritsched(const pthread_attr_t *__restrict attr, int *__restrict inheritsched); int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy); int pthread_attr_getschedpolicy(const pthread_attr_t *__restrict attr, int *__restrict policy); int pthread_attr_setschedparam(pthread_attr_t *__restrict attr, const struct sched_param *__restrict param); int pthread_attr_getschedparam(const pthread_attr_t *__restrict attr, struct sched_param *__restrict param); int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope); int pthread_attr_getscope(const pthread_attr_t *__restrict attr, int *__restrict contentionscope); int pthread_attr_setprocessor_np(pthread_attr_t *attr, pthread_spu_t processor, int binding_type); int pthread_attr_getprocessor_np(const pthread_attr_t *attr, pthread_spu_t *processor, int *binding_type); PARAMETERS
DESCRIPTIONThese functions set and get the attributes as described below. pthread_attr_setdetachstate() - set the detachstate attribute. pthread_attr_getdetachstate() - get the detachstate attribute. pthread_attr_setstacksize() - set the stacksize attribute. pthread_attr_getstacksize() - get the stacksize attribute. pthread_attr_setrsestacksize_np() - set the rsestacksize attribute. pthread_attr_getrsestacksize_np() - get the rsestacksize attribute. pthread_attr_setstackaddr() - set the stackaddr attribute. pthread_attr_getstackaddr() - get the stackaddr attribute. pthread_attr_setstack() - set the stacksize, stackaddr attributes. pthread_attr_getstack() - get the stacksize, stackaddr attributes. pthread_attr_setguardsize() - set the guardsize attribute. pthread_attr_getguardsize() - get the guardsize attribute. pthread_attr_setinheritsched() - set the inheritsched attribute. pthread_attr_getinheritsched() - get the inheritsched attribute. pthread_attr_setschedpolicy() - set the schedpolicy attribute. pthread_attr_getschedpolicy() - get the schedpolicy attribute. pthread_attr_setschedparam() - set the schedparam attributes. pthread_attr_getschedparam() - get the schedparam attributes. pthread_attr_setscope() - set the contentionscope attribute. pthread_attr_getscope() - get the contentionscope attribute. pthread_attr_setprocessor_np() - set the processor and binding_type attributes. pthread_attr_getprocessor_np() - get the processor and binding_type attributes. The attributes object attr must have previously been initialized with the function pthread_attr_init() before these functions are called. ATTRIBUTE: detachstateThe legal values for the detachstate attribute are:
The default value of detachstate is PTHREAD_CREATE_JOINABLE. pthread_attr_setdetachstate() is used to set the detachstate attribute in the initialized attributes object attr. The new value of the detachstate attribute is passed to this function in the detachstate parameter. pthread_attr_getdetachstate() retrieves the value of the detachstate attribute from the thread attributes object attr. This value is returned in the detachstate parameter. ATTRIBUTE: stacksizeThe legal values for the stacksize attribute are:
POSIX.1c does not define a default value. On HP-UX released on PA-RISC platforms, the default value of the stacksize attribute is 64K, and 256K in HP-UX released on Itanium(R)-based platforms. On Itanium-based systems, stack is equally divided into memory stack and register stack. pthread_attr_setstacksize() is used to set the stacksize attribute in the initialized attributes object attr. The new value of the stacksize attribute is passed to this function in the stacksize parameter. While modifying the stacksize attribute on Itanium-based platform, user must keep account of memory stack as well as register stack requirement. pthread_attr_getstacksize() retrieves the value of the stacksize attribute from the thread attributes object attr. This value is returned in the stacksize parameter. pthread_attr_setstack() is used to set the stacksize and stackaddr attributes in the initialized attributes object attr. The new value of the stacksize attribute is passed to this function in stacksize parameter. The new value of the stackaddr attribute is passed to this function in stackaddr parameter. Refer to ATTRIBUTE stackaddr for information on stackaddr attribute. pthread_attr_getstack() retrieves the value of stacksize and stackaddr attributes from the thread attributes object attr. These values are returned in the stacksize parameter and stackaddr parameter. Refer to ATTRIBUTE stackaddr for information on stackaddr attribute. ATTRIBUTE: rsestacksizeThe legal values for the rsestacksize are:
pthread_attr_setrsestacksize_np() is used to set the register stack size for a thread and pthread_default_rsestacksize_np() to set the default register stack size. If either of the set register stack size APIs is called, the register stack portion of the stack space will be that large instead of implementation defined division. The memory stack portion will be the remainder. pthread_attr_getrsestacksize_np() retrieves the value of the rsestacksize attribute from the thread attributes object attr. This value is returned in the rsestacksize parameter. ATTRIBUTE: stackaddrThe legal values for the stackaddr attribute are:
The default value of the stackaddr attribute is NULL. pthread_attr_setstackaddr() is used to set the stackaddr attribute in the initialized attributes object attr. The new value of the stackaddr attribute is passed to this function in the stackaddr parameter. If the size of stack pointed to by stackaddr is different from the default stack size, the application must call pthread_attr_setstacksize() to set the new stack size. pthread_attr_getstackaddr() retrieves the value of the stackaddr attribute from the thread attributes object attr. This value is returned in the stackaddr parameter. The guardsize attribute is ignored if the storage for the thread's user stack is not allocated by the library (i.e., the stackaddr attribute is not NULL). ATTRIBUTE: guardsizeThe guardsize attribute allows an application to specify the size of the guard area for threads created with this attributes object. The size of the guard area is specified in bytes. Most systems will round up the guard size to a multiple of the system configurable variable PAGESIZE. If the value zero is specified, a guard area will not be created. The default value of guardsize is PAGESIZE bytes. The actual value of PAGESIZE is implementation-dependent and may not be the same on all implementations. The guardsize attribute is ignored if the storage for the user stack is not allocated by the pthread library. The application is responsible for protecting against stack overflow. pthread_attr_setguardsize() is used to set the guardsize attribute in the initialized attributes object attr. The new value of the guardsize attribute is passed to this function in the guardsize parameter. pthread_attr_getguardsize() retrieves the value of the guardsize attribute from the thread attributes object attr. This value is returned in the guardsize parameter. If the guard area is rounded up to a multiple of PAGESIZE, a call to this function shall store in the guardsize parameter the guard size specified in the previous pthread_attr_setguardsize() function call. ATTRIBUTE: inheritschedThe legal values for the inheritsched attribute are:
POSIX.1c does not define a default value for the inheritsched attribute. On HP-UX, the default value is PTHREAD_INHERIT_SCHED. pthread_attr_setinheritsched() is used to set the inheritsched attribute in the initialized attributes object attr. The new value of the inheritsched attribute is passed in the inheritsched parameter. pthread_attr_getinheritsched() retrieves the value of the inheritsched attribute from the thread attributes object attr. This value is returned in the inheritsched parameter. ATTRIBUTE: schedpolicyThe schedpolicy attribute allows threads created with this attributes object to use a specific scheduling policy. To use this attribute, the inheritsched attribute must be set to PTHREAD_EXPLICIT_SCHED. For a complete list of valid scheduling policies, refer to rtsched(2) and <sched.h>. POSIX.1c does not specify a default value for the schedpolicy attribute. On HP-UX, the default value for system scope threads is SCHED_TIMESHARE. pthread_attr_setschedpolicy() is used to set the schedpolicy attribute in the initialized attributes object attr. The new value of the schedpolicy attribute is passed to this function in the policy parameter. pthread_attr_getschedpolicy() retrieves the value of the schedpolicy attribute from the thread attributes object attr. This value is returned in the policy parameter. ATTRIBUTE: schedparamThe legal values for the schedparam attribute associated with the schedpolicy attribute vary depending upon the scheduling policy. For the SCHED_FIFO and SCHED_RR scheduling policies, only the sched_priority member of the schedparam attribute is required. Legal values for sched_priority can be obtained through sched_get_priority_max() and sched_get_priority_min(). The required contents of schedparam for other scheduling policies is undefined. For a complete list of required and valid scheduling parameters for all scheduling policies, refer to rtsched(2) and <sched.h>. pthread_attr_setschedparam() is used to set the schedparam attribute in the initialized attributes object attr. The new value of the schedparam attribute is passed to this function in the param parameter. pthread_attr_getschedparam() retrieves the value of the schedparam attribute from the thread attributes object attr. This value is returned in the param parameter. ATTRIBUTE: contentionscopeThe legal values for the contentionscope attribute are:
The default value of the contentionscope attribute is not defined by POSIX.1c. The default value of the contentionscope attribute is set to be PTHREAD_SCOPE_SYSTEM. This default scope can also be controlled externally by using the options documented in the pthread_scope_options(5) manpage. pthread_attr_setscope() is used to set the contentionscope attribute in the initialized attributes object attr. The new value of the contentionscope attribute is passed to this function in the contentionscope parameter. pthread_attr_getscope() retrieves the value of the contentionscope attribute from the thread attributes object attr. This value is returned in the contentionscope parameter. ATTRIBUTES: processor and binding_typeThe legal values for the processor attribute are:
The legal values for the binding_type attribute (if the processor attribute is not PTHREAD_SPUINHERIT_NP, PTHREAD_SPUFLOAT_NP, PTHREAD_LDOMINHERIT_NP, or PTHREAD_LDOMFLOAT_NP) are:
The default value of the processor attribute is PTHREAD_SPUINHERIT_NP. The default value of the binding_type attribute is PTHREAD_BIND_NONE_NP. pthread_attr_setprocessor_np() is used to set the processor and binding_type attributes in the initialized attributes object attr. The new values of the processor and binding_type attributes are passed to this function in the processor and binding_type parameters, respectively. pthread_attr_getprocessor_np() retrieves the values of the processor and binding_type attributes from the thread attributes object attr. These values are returned in the processor and binding_type parameters, respectively. If the value of the processor attribute is PTHREAD_SPUINHERIT_NP, PTHREAD_SPUFLOAT_NP, PTHREAD_LDOMINHERIT_NP, or PTHREAD_LDOMFLOAT_NP the value of the binding_type attribute should be ignored (float implies there will be no binding for the created thread, inherit implies that the attribute will be set when the new thread is created based on the creating thread's attributes). If the value of the binding_type attribute is PTHREAD_BIND_NONE_NP the processor attribute should be ignored. RETURN VALUEUpon successful completion, the following functions return zero: pthread_attr_setstacksize(), pthread_attr_getstacksize(), pthread_attr_setstackaddr(), pthread_attr_getstackaddr(), pthread_attr_setguardsize(), pthread_attr_getstack(), pthread_attr_setstack(), pthread_attr_getguardsize(), pthread_attr_setdetachstate(), pthread_attr_getdetachstate(), pthread_attr_setinheritsched(), pthread_attr_getinheritsched(), pthread_attr_setschedpolicy(), pthread_attr_getschedpolicy(), pthread_attr_setschedparam(), pthread_attr_getschedparam(), pthread_attr_setprocessor_np(), pthread_attr_getprocessor_np(), pthread_attr_setscope(), and pthread_attr_getscope(). Otherwise, an error number is returned to indicate the error (the errno variable is not set). ERRORSIf any of the following occur, the pthread_attr_setscope(), pthread_attr_getscope(), pthread_attr_setinheritsched(), pthread_attr_getinheritsched(), pthread_attr_setschedpolicy(), and pthread_attr_getschedpolicy() functions return the corresponding error number:
If any of the following occur, the pthread_attr_getstackaddr() and pthread_attr_setstackaddr() functions return the corresponding error number:
If any of the following occur, the pthread_attr_getstacksize() and pthread_attr_setstacksize() functions return the corresponding error number:
If any of the following occur, pthread_attr_setstacksize(), pthread_attr_getstacksize(), pthread_attr_setstackaddr(), pthread_attr_getstackaddr(), pthread_attr_setstack(), pthread_attr_getstack(), pthread_attr_setrsestackszie_np(), pthread_attr_getrsestackszie_np(), pthread_attr_setguardsize(), pthread_attr_getguardsize(), pthread_attr_setdetachstate(), pthread_attr_getdetachstate(), pthread_attr_setinheritsched(), pthread_attr_getinheritsched(), pthread_attr_setschedpolicy(), pthread_attr_getschedpolicy(), pthread_attr_setschedparam(), pthread_attr_getschedparam(), pthread_attr_setprocessor_np(), pthread_attr_getprocessor_np(), pthread_attr_setscope(), and pthread_attr_getscope() return the corresponding error number:
AUTHORpthread_attr_setstacksize(), pthread_attr_getstacksize(), pthread_attr_setstackaddr(), pthread_attr_getstackaddr(), pthread_attr_setdetachstate(), pthread_attr_getdetachstate(), pthread_attr_setinheritsched(), pthread_attr_getinheritsched(), pthread_attr_setschedpolicy(), pthread_attr_getschedpolicy(), pthread_attr_setschedparam(), pthread_attr_getschedparam(), pthread_attr_setscope(), and pthread_attr_getscope() were derived from the IEEE POSIX P1003.1c standard. pthread_attr_setguardsize() and pthread_attr_getguardsize() were developed by X/Open. pthread_attr_setprocessor_np() and pthread_attr_getprocessor_np() were developed by HP. SEE ALSOpthread_create(3T), pthread_attr_init(3T), pthread_processor_bind_np(3T), pthread_default_stacksize_np(3T), pthread_scope_options(5). STANDARDS CONFORMANCEpthread_attr_setstacksize(): POSIX 1003.1c. pthread_attr_getstacksize(): POSIX 1003.1c. pthread_attr_setstacksize(): POSIX 1003.1c. pthread_attr_getstacksize(): POSIX 1003.1c. pthread_attr_setstackaddr(): POSIX 1003.1c. pthread_attr_getstackaddr(): POSIX 1003.1c. pthread_attr_setstack(): POSIX 1003.1c. pthread_attr_getstack(): POSIX 1003.1c. pthread_attr_setguardsize(): X/Open. pthread_attr_getguardsize(): X/Open. pthread_attr_setdetachstate(): POSIX 1003.1c. pthread_attr_getdetachstate(): POSIX 1003.1c. pthread_attr_setinheritsched(): POSIX 1003.1c. pthread_attr_getinheritsched(): POSIX 1003.1c. pthread_attr_setschedpolicy(): POSIX 1003.1c. pthread_attr_getschedpolicy(): POSIX 1003.1c. pthread_attr_setschedparam(): POSIX 1003.1c. pthread_attr_getschedparam(): POSIX 1003.1c. pthread_attr_setscope(): POSIX 1003.1c. pthread_attr_getscope(): POSIX 1003.1c. pthread_attr_setprocessor_np(): None. pthread_attr_getprocessor_np(): None. pthread_attr_getrsestacksize_np(): None. pthread_attr_setrsestacksize_np(): None.
|
Printable version | ||
|