Sets the value of the stacksize attribute of a thread attributes object.
Threads Library (libpthreads.a)
#include <pthread.h> int pthread_attr_setstacksize (attr, stacksize) pthread_attr_t *attr; size_t stacksize;
The pthread_attr_setstacksize subroutine sets the value of the stacksize attribute of the thread attributes object attr. This attribute specifies the minimum stack size, in bytes, of a thread created with this attributes object.
The allocated stack size is always a multiple of 8K bytes, greater or equal to the required minimum stack size of 56K bytes (PTHREAD_STACK_MIN). The following formula is used to calculate the allocated stack size: if the required stack size is lower than 56K bytes, the allocated stack size is 56K bytes; otherwise, if the required stack size belongs to the range from (56 + (n - 1) * 16) K bytes to (56 + n * 16) K bytes, the allocated stack size is (56 + n * 16) K bytes.
Upon successful completion, 0 is returned. Otherwise, an error code is returned.
The pthread_attr_setstacksize subroutine is unsuccessful if the following is true:
EINVAL | The attr parameter is not valid, or the value of the stacksize parameter exceeds a system imposed limit. |
ENOSYS | The stack size POSIX option is not implemented. |
The pthread_attr_getstacksize (pthread_attr_getstacksize Subroutine) subroutine, pthread_attr_init (pthread_attr_init Subroutine) subroutine, pthread_create (pthread_create Subroutine) subroutine, the pthread.h file.
Advanced Attributes in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
Threads Library Options and Threads Library Quick Reference in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.