Multithreaded Programming Guide

Get Stack Size


pthread_attr_getstacksize(3THR) returns the stack size set by pthread_attr_setstacksize().


int	pthread_attr_getstacksize(pthread_attr_t *tattr, size_t *size);
#include <pthread.h>

pthread_attr_t tattr;
int size;
int ret;

/* getting the stack size */
ret = pthread_attr_getstacksize(&tattr, &size);

Return Values

Returns zero after completing successfully. Any other returned value indicates that an error occurred. If the following condition occurs, the function fails and returns the corresponding value.


The value returned is less than the value of PTHREAD_STACK_MIN, or exceeds a system-imposed limit.