HP-UX Reference (11i v2 03/08) - 3 Library Functions N-Z (vol 7)

p
pthread_attr_getdetachstate(3T) pthread_attr_getdetachstate(3T)
(Pthread Library)
PTHREAD_CREATE_JOINABLE
This option causes all threads created with attr to be in the joinable state. The resources asso-
ciated with threads having this state are not reclaimed when the threads terminate. An appli-
cation must call the pthread_detach()
or pthread_join()
functions for threads
created with this attribute to reclaim the system resources.
The default value of detachstate is
PTHREAD_CREATE_JOINABLE
.
pthread_attr_setdetachstate()
is used to set the detachstate attribute in the initialized attri-
butes 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: stacksize
The legal values for the stacksize attribute are:
PTHREAD_STACK_MIN
This option specifies that the size of the user stack for threads created with this attributes
object will be of default stack size. This value is the minimum stack size (in bytes) required for
a thread. This minimum value may not be acceptable for all threads.
stacksize
This defines the size (in bytes) of the user stack for threads created with this attributes object.
This value must be greater than or equal to the minimum stack size
PTHREAD_STACK_MIN
.
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.
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.
pthread_attr_getstacksize()
retrieves the value of the stacksize attribute from the thread attri-
butes object attr . This value is returned in the stacksize parameter.
ATTRIBUTE: stackaddr
The legal values for the stackaddr attribute are:
NULL
This option specifies that the storage for the user stack of any threads created with this attri-
butes object will be allocated and deallocated by the threads library. The application does not
need to allocate and manage thread stacks.
stack_address
This option specifies the base address of a stack that the created thread will use. The applica-
tion is completely responsible for allocating, managing, and deallocating these stacks. Some
options for allocation of storage are the malloc(3C), brk(2), and mmap(2) functions. Note: if
this option is used, only one thread should be created with this attributes object. If multiple
threads are created, they will all use the same stack.
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 parame-
ter. 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: guardsize
The 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.
HP-UX 11i Version 2: August 2003 3 Hewlett-Packard Company Section 3739