Open System Services System Calls Reference Manual (G06.25+, H06.03+)
System Functions (n - p) pthread_attr_setstacksize(2)
NAME
pthread_attr_setstacksize
- Sets the stacksize attribute of a thread attributes object
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <spthread.h>
int pthread_attr_setstacksize(
pthread_attr_t *attr,
size_t stacksize );
PARAMETERS
attr specifies the address of the thread attributes object whose stacksize attribute is
to be set.
stacksize specifies the new value for the stacksize attribute. The stacksize parameter must
be greater than or equal to PTHREAD_STACK_MIN, which is the minimum
size (in bytes) of stack needed for a thread.
DESCRIPTION
This function sets the value of the stacksize attribute in the thread attributes object specified by
the attr parameter to the value specified by the stacksize parameter. Use this function to adjust
the size of the writable area of the stack for a new thread.
The size of a thread’s stack is fixed at the time of thread creation. Only the initial thread can
dynamically extend its stack.
NOTES
Many compilers do not check for stack overflow. Ensure that the new thread’s stack is big
enough for the resources required by routines that are called from the thread.
RETURN VALUES
If an error condition occurs, this function returns an integer value indicating the type of error.
Possible return values are:
0 Successful completion.
[EINVAL] The value specified by the attr parameter is invalid, or the value specified by the
stacksize parameter either is less than PTHREAD_STACK_MIN or exceeds a
system-imposed limit.
RELATED INFORMATION
Functions: pthread_attr_init(2), pthread_attr_getstacksize(2), pthread_create(2).
STANDARDS CONFORMANCE
This function is an extension to the XPG4 Version 2 specification. Interfaces documented on this
reference page conform to the following industry standards:
• IEEE Std 1003.1c-1995, POSIX System Application Program Interface
The use of the header file spthread.h is an HP exception to the POSIX standard.
527186-003 Hewlett-Packard Company 5−37